Interface: AppCache<K, V>
Defined in: src/utils/cache.ts:111
Internal
Public cache operations exposed by the shared app cache instances.
Type Parametersโ
Kโ
K
Type of cache keys.
Vโ
V
Type of cached values.
Propertiesโ
sizeโ
readonly size: number;
Defined in: src/utils/cache.ts:115
Current number of entries in the cache.
cleanupโ
readonly cleanup: () => void;
Defined in: src/utils/cache.ts:120
Remove expired entries from the cache.
Returnsโ
void
clearโ
readonly clear: () => void;
Defined in: src/utils/cache.ts:125
Remove all entries from the cache.
Returnsโ
void
deleteโ
readonly delete: (key: K) => boolean;
Defined in: src/utils/cache.ts:134
Delete a specific key from the cache.
Parametersโ
keyโ
K
The cache key to remove.
Returnsโ
boolean
True if the key existed and was removed; false otherwise.
getโ
readonly get: (key: K) => V | undefined;
Defined in: src/utils/cache.ts:144
Retrieve a value if present and not expired.
Parametersโ
keyโ
K
The cache key to look up.
Returnsโ
V | undefined
The cached value, or undefined when the key does not exist or
the entry has expired.
hasโ
readonly has: (key: K) => boolean;
Defined in: src/utils/cache.ts:153
Check whether a non-expired entry exists for the given key.
Parametersโ
keyโ
K
The cache key to test.
Returnsโ
boolean
True when a valid value exists; false otherwise.
setโ
readonly set: (key: K, value: V, ttl?: number) => void;
Defined in: src/utils/cache.ts:163
Insert or update an entry in the cache and optionally specify a per-entry TTL that overrides the cache default.
Parametersโ
keyโ
K
The cache key to set.
valueโ
V
The value to store under the provided key.
ttl?โ
number
Optional per-entry TTL in milliseconds.
Returnsโ
void