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[]
parsers

All loader parsers registered

Methods from Cache

T
get(key: string)
boolean
has(key: string)
void
remove(key: string)

Remove entry by key

void
reset()

Clear all entries.

void
set(key: string | string[], value: unknown)

Public Properties


parsers Cache.ts:173
parsers: CacheParser[]

All loader parsers registered

Public Methods


get Cache.ts:46
get(key: string) → {T}

Fetch entry by key

Parameters:
Name Type Description
key string

The key of the entry to get

Returns:
Type Description
T
has Cache.ts:37
has(key: string) → {boolean}

Check if the key exists

Parameters:
Name Type Description
key string

The key to check

Returns:
Type Description
boolean
remove Cache.ts:139
remove(key: string) → {void}

Remove entry by key

This function will also remove any associated alias from the cache also.

Parameters:
Name Type Description
key string

The key of the entry to remove

Returns:
Type Description
void
reset Cache.ts:30
reset() → {void}

Clear all entries.

Returns:
Type Description
void
set Cache.ts:64
set(key: string | string[], value: unknown) → {void}

Set a value by key or keys name

Parameters:
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.

Returns:
Type Description
void

Powered by webdoc!