Class LocalCache

Cache that allows you to store data on the client. The stored data cannot be relied on to be present, as it can be purged from the cache at any moment.

Hierarchy

  • FrameworkObject
    • LocalCache

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns LocalCache

Methods

  • Attempts to retrieve an entry from the cache.

    Parameters

    • path: FilePath

      Path of the data entry as a relative path.

    Returns number[]

    The output buffer for the cached bytes.

  • Attempts to retrieve a Resource entry from the cache.

    Parameters

    • path: FilePath

      Path of the data entry as a relative path.

    Returns Resource

    Resource at the provided path, if found. Null otherwise.

  • Removes the specified entry from the cache.

    Parameters

    Returns boolean

    True if the entry was remove from the cache, false otherwise.

  • Adds a new data entry to the cache.

    Parameters

    • path: FilePath

      Path to add the data entry to. Must be a relative path. Any existing entry at the path will be overwritten.

    • data: number[]

      Data to store in the cache. Set to null to clear an existing data entry.

    • Optionalpriority: EnumValue<CachePriority, number>

      Priority of the entry that determines order of eviction when the cache is full. Entries with higher priority will be evicted last.

    • OptionalcacheDurationInSeconds: number

    Returns boolean

    True if the entry was added to the cache, false otherwise.

  • Adds a new resource entry to the cache.

    Parameters

    • path: FilePath

      Path to add the data entry to. Must be a relative path. Any existing entry at the path will be overwritten.

    • resource: Resource

      Resource to store in the cache. Set to null to clear an existing data entry.

    • Optionalpriority: EnumValue<CachePriority, number>

      Priority of the entry that determines order of eviction when the cache is full. Entries with higher priority will be evicted last.

    • OptionalcacheDurationInSeconds: number

    Returns boolean

    True if the entry was added to the cache, false otherwise.