PIXI.Cache
class Cache
A single Cache for all assets.
When assets are added to the cache via set they normally are added to the cache as key-value pairs.
With this cache, you can add parsers that will take the object and convert it to a list of assets that can be cached. for example a cacheSprite Sheet parser will add all of the textures found within its sprite sheet directly to the cache.
This gives devs the flexibility to cache any type of object however we want.
It is not intended that this class is created by developers - it is part of the Asset package. This is the first major system of PixiJS' main Assets class.
Constructor
new PIXI.Cache() → {}
A single Cache for all assets.
Summary
Properties from Cache
CacheParser[] |
All loader parsers registered |
Methods from Cache
T |
|
boolean |
|
void |
Remove entry by key |
void |
Clear all entries. |
void |
|
Public Methods
get(key: string) → {T}
Fetch entry by key
Name | Type | Description |
---|---|---|
key | string |
The key of the entry to get |
Type | Description |
---|---|
T |
has(key: string) → {boolean}
Check if the key exists
Name | Type | Description |
---|---|---|
key | string |
The key to check |
Type | Description |
---|---|
boolean |
remove(key: string) → {void}
Remove entry by key
This function will also remove any associated alias from the cache also.
Name | Type | Description |
---|---|---|
key | string |
The key of the entry to remove |
Type | Description |
---|---|
void |
set(key: string | string[], value: unknown) → {void}
Set a value by key or keys name
Name | Type | Description |
---|---|---|
key | string | string[] |
The key or keys to set |
value | unknown |
The value to store in the cache or from which cacheable assets will be derived. |
Type | Description |
---|---|
void |