AsyncCache
Defined in: asset/AsyncCache.ts:16
Type Parameters
Section titled “Type Parameters”T
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AsyncCache<
T>(dispose_?):AsyncCache<T>
Defined in: asset/AsyncCache.ts:28
Parameters
Section titled “Parameters”dispose_?
Section titled “dispose_?”(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.
Returns
Section titled “Returns”AsyncCache<T>
Methods
Section titled “Methods”clear()
Section titled “clear()”clear():
void
Defined in: asset/AsyncCache.ts:162
Returns
Section titled “Returns”void
clearAll()
Section titled “clearAll()”clearAll():
void
Defined in: asset/AsyncCache.ts:166
Returns
Section titled “Returns”void
delete()
Section titled “delete()”delete(
key):boolean
Defined in: asset/AsyncCache.ts:138
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
entries()
Section titled “entries()”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.
Returns
Section titled “Returns”IterableIterator<[string, T]>
get(
key):T|undefined
Defined in: asset/AsyncCache.ts:130
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”T | undefined
getOrLoad()
Section titled “getOrLoad()”getOrLoad(
key,loader,timeout?):Promise<T>
Defined in: asset/AsyncCache.ts:30
Parameters
Section titled “Parameters”string
loader
Section titled “loader”() => Promise<T>
timeout?
Section titled “timeout?”number = RuntimeConfig.assetLoadTimeout
Returns
Section titled “Returns”Promise<T>
has(
key):boolean
Defined in: asset/AsyncCache.ts:134
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
invalidate()
Section titled “invalidate()”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).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
T
Returns
Section titled “Returns”void
values()
Section titled “values()”values():
IterableIterator<T>
Defined in: asset/AsyncCache.ts:188
Returns
Section titled “Returns”IterableIterator<T>