CacheEngine
API Reference for the CacheEngine class
CacheEngine
High-performance cache with automatic garbage collection and dependency tracking.
Import
Constructor
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
staleTime | number | 300000 (5 min) | Default stale time |
gcTime | number | 1800000 (30 min) | Garbage collection time |
maxSize | number | 100000 | Maximum cache entries |
Methods
get<T>(queryKey)
Get cache entry by key.
getByHash<T>(keyHash)
Get cache entry by hash.
set<T>(options)
Create or update cache entry.
delete(queryKey)
Delete cache entry.
invalidate(queryKey)
Invalidate entry and dependencies.
invalidateAll(predicate?)
Bulk invalidate entries.
clear()
Clear all entries.
collectGarbage()
Remove expired entries.
has(queryKey)
Check if entry exists.
entries()
Get all cache entries.
getStats()
Get cache statistics.
Properties
| Property | Type | Description |
|---|---|---|
size | number | Number of entries |