web / lib/services/cache/manager
lib/services/cache/manager
Cache manager for creating and managing cache instances.
This manager provides a factory pattern for creating cache instances with different storage backends and configurations. It manages singleton instances and provides global cache operations.
Enumerations
CacheBackend
Enumeration Members
MEMORY
MEMORY:
"memory"
FILESYSTEM
FILESYSTEM:
"filesystem"
Classes
CacheManager
Cache manager for creating and managing cache instances
Constructors
Constructor
new CacheManager():
CacheManager
Returns
Methods
getCache()
staticgetCache(name,backend?,config?):Cache
Create or get a cache instance
Parameters
name
string = "default"
backend?
config?
Partial<CacheConfig>
Returns
clearAll()
staticclearAll():Promise<void>
Clear all cache instances
Returns
Promise<void>
getAllStats()
staticgetAllStats():Promise<Record<string,CacheStats>>
Get stats for all caches
Returns
Promise<Record<string, CacheStats>>
cleanupAll()
staticcleanupAll():Promise<number>
Cleanup all cache instances
Returns
Promise<number>
destroyAll()
staticdestroyAll():Promise<void>
Destroy all cache instances
Returns
Promise<void>
getInstance()
staticgetInstance(name):undefined|Cache
Get a specific cache instance if it exists
Parameters
name
string
Returns
undefined | Cache
hasInstance()
statichasInstance(name):boolean
Check if a cache instance exists
Parameters
name
string
Returns
boolean