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:146
Returns
Section titled “Returns”void
clearAll()
Section titled “clearAll()”clearAll():
void
Defined in: asset/AsyncCache.ts:150
Returns
Section titled “Returns”void
delete()
Section titled “delete()”delete(
key):boolean
Defined in: asset/AsyncCache.ts:122
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
get(
key):T|undefined
Defined in: asset/AsyncCache.ts:114
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:118
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
invalidate()
Section titled “invalidate()”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).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
values()
Section titled “values()”values():
IterableIterator<T>
Defined in: asset/AsyncCache.ts:159
Returns
Section titled “Returns”IterableIterator<T>