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:146

void


clearAll(): void

Defined in: asset/AsyncCache.ts:150

void


delete(key): boolean

Defined in: asset/AsyncCache.ts:122

string

boolean


get(key): T | undefined

Defined in: asset/AsyncCache.ts:114

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:118

string

boolean


invalidate(key): boolean

Defined in: asset/AsyncCache.ts:135

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


values(): IterableIterator<T>

Defined in: asset/AsyncCache.ts:159

IterableIterator<T>