CacheMap
Class: CacheMap<T>
Defined in: packages/cache/src/cache.ts:238
Cache map storing CacheStorage per instance key.
The instance key is produced by classKeyGenerator.
Extends
Map<T,CacheStorage>
Type Parameters
T
T extends object = object
Constructors
Constructor
new CacheMap<
T>(options?):CacheMap<T>
Defined in: packages/cache/src/cache.ts:244
Create a new CacheMap.
Parameters
options?
cache configuration options
Returns
CacheMap<T>
Overrides
Map<T, CacheStorage>.constructor
Properties
[toStringTag]
readonly[toStringTag]:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137
Inherited from
Map.[toStringTag]
size
readonlysize:number
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:45
Returns
the number of elements in the Map.
Inherited from
Map.size
[species]
readonlystatic[species]:MapConstructor
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319
Inherited from
Map.[species]
Methods
[iterator]()
[iterator]():
MapIterator<[T,CacheStorage]>
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143
Returns an iterable of entries in the map.
Returns
MapIterator<[T, CacheStorage]>
Inherited from
Map.[iterator]
clear()
clear():
void
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:20
Returns
void
Inherited from
Map.clear
delete()
delete(
key):boolean
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
Parameters
key
T
Returns
boolean
true if an element in the Map existed and has been removed, or false if the element does not exist.
Inherited from
Map.delete
entries()
entries():
MapIterator<[T,CacheStorage]>
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:148
Returns an iterable of key, value pairs for every entry in the map.
Returns
MapIterator<[T, CacheStorage]>
Inherited from
Map.entries
forEach()
forEach(
callbackfn,thisArg?):void
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:28
Executes a provided function once per each key/value pair in the Map, in insertion order.
Parameters
callbackfn
(value, key, map) => void
thisArg?
any
Returns
void
Inherited from
Map.forEach
garbageCollect()
garbageCollect():
void
Defined in: packages/cache/src/cache.ts:311
Trigger garbage collection on all instance stores.
Returns
void
get()
get(
key):CacheStorage|undefined
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:33
Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
Parameters
key
T
Returns
CacheStorage | undefined
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
Inherited from
Map.get
getCachedMethod()
getCachedMethod(
target,key):any
Defined in: packages/cache/src/cache.ts:259
Get a cached value for a given instance and method key.
Parameters
target
T
the instance key
key
string
the method cache key
Returns
any
the cached value or undefined
getStats()
getStats():
CacheStats
Defined in: packages/cache/src/cache.ts:348
Get aggregated statistics across all instance caches.
Returns
the aggregated stats
has()
has(
key):boolean
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:37
Parameters
key
T
Returns
boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
Map.has
hasCachedMethod()
hasCachedMethod(
target,key):boolean
Defined in: packages/cache/src/cache.ts:274
Check if a cached value exists for the given instance and method key. Tracks cache hits when enableStats is true (misses tracked in setCachedMethod).
Parameters
target
T
the instance key
key
string
the method cache key
Returns
boolean
true if a valid cached entry exists
keys()
keys():
MapIterator<T>
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153
Returns an iterable of keys in the map
Returns
MapIterator<T>
Inherited from
Map.keys
resetStats()
resetStats():
void
Defined in: packages/cache/src/cache.ts:363
Reset statistics for all instance caches.
Returns
void
set()
set(
key,value):this
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:41
Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
Parameters
key
T
value
Returns
this
Inherited from
Map.set
setCachedMethod()
setCachedMethod(
target,key,_args,value):void
Defined in: packages/cache/src/cache.ts:295
Store a cached value for the given instance + method key. Tracks misses when enableStats is true (only if key didn't exist).
Parameters
target
T
the instance key
key
string
the method cache key
_args
any[]
original method arguments (reserved)
value
any
the value to cache
Returns
void
stopAutoGC()
stopAutoGC():
void
Defined in: packages/cache/src/cache.ts:336
Stop automatic garbage collection timer.
Returns
void
values()
values():
MapIterator<CacheStorage>
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158
Returns an iterable of values in the map
Returns
MapIterator<CacheStorage>
Inherited from
Map.values