Skip to content

AsyncCache

Defined in: asset/AsyncCache.ts:16

T

new AsyncCache<T>(dispose_?): AsyncCache<T>

Defined in: asset/AsyncCache.ts:28

(value) => void

Optional releaser for a value whose load finishes AFTER its getOrLoad already timed out — the caller got the timeout rejection, so that late value has no owner and would otherwise leak (e.g. a GL texture created past the deadline). NOT called for invalidate()/clearAll(), whose in-flight results still reach the caller.

AsyncCache<T>

clear(): void

Defined in: asset/AsyncCache.ts:162

void


clearAll(): void

Defined in: asset/AsyncCache.ts:166

void


delete(key): boolean

Defined in: asset/AsyncCache.ts:138

string

boolean


entries(): IterableIterator<[string, T]>

Defined in: asset/AsyncCache.ts:184

Key/value pairs of what is resolved. values() is not enough for a sweep that has to RELOAD each entry: the key is what names the asset.

IterableIterator<[string, T]>


get(key): T | undefined

Defined in: asset/AsyncCache.ts:130

string

T | undefined


getOrLoad(key, loader, timeout?): Promise<T>

Defined in: asset/AsyncCache.ts:30

string

() => Promise<T>

number = RuntimeConfig.assetLoadTimeout

Promise<T>


has(key): boolean

Defined in: asset/AsyncCache.ts:134

string

boolean


invalidate(key): boolean

Defined in: asset/AsyncCache.ts:151

Drop every record of key — resolved value, failure cooldown, and any in-flight loader. Used by hot-reload when the underlying bytes changed on disk and the next getOrLoad must fetch fresh.

Returns true if any record was removed. Doesn’t release whatever resource the cached value points to — that’s the caller’s concern (see Assets.invalidate for the resource-aware variant).

string

boolean


set(key, value): void

Defined in: asset/AsyncCache.ts:176

Re-file a value under key, for a sweep that removed it to force a reload.

string

T

void


values(): IterableIterator<T>

Defined in: asset/AsyncCache.ts:188

IterableIterator<T>