phaser - v4.0.0-rc.4
    Preparing search index...

    The BaseCache is a base Cache class that can be used for storing references to any kind of data.

    Data can be added, retrieved and removed based on the given keys.

    Keys are string-based.

    Index

    Constructors

    Properties

    entries: Structs.Map<String, any>

    The Map in which the cache objects are stored.

    You can query the Map directly or use the BaseCache methods.

    events: EventEmitter

    An instance of EventEmitter used by the cache to emit related events.

    Methods

    • Adds an item to this cache. The item is referenced by a unique string, which you are responsible for setting and keeping track of. The item can only be retrieved by using this string.

      Parameters

      • key: string

        The unique key by which the data added to the cache will be referenced.

      • data: any

        The data to be stored in the cache.

      Returns this

    • Checks if this cache contains an item matching the given key. This performs the same action as BaseCache.has and is called directly by the Loader.

      Parameters

      • key: string

        The unique key of the item to be checked in this cache.

      Returns boolean

    • Gets an item from this cache based on the given key.

      Parameters

      • key: string

        The unique key of the item to be retrieved from this cache.

      Returns any

    • Checks if this cache contains an item matching the given key. This performs the same action as BaseCache.exists.

      Parameters

      • key: string

        The unique key of the item to be checked in this cache.

      Returns boolean

    • Removes and item from this cache based on the given key.

      If an entry matching the key is found it is removed from the cache and a remove event emitted. No additional checks are done on the item removed. If other systems or parts of your game code are relying on this item, it is up to you to sever those relationships prior to removing the item.

      Parameters

      • key: string

        The unique key of the item to remove from the cache.

      Returns this