web / lib/services/cache/storage/file-system
lib/services/cache/storage/file-system
File system cache storage implementation.
This storage backend persists cache entries to the file system, allowing data to survive process restarts. It organizes cache files in subdirectories for better performance with large numbers of entries and maintains an index for fast lookups.
Classes
FileSystemCacheStorage
Cache storage interface for different backends
Implements
Constructors
Constructor
new FileSystemCacheStorage(
options):FileSystemCacheStorage
Parameters
options
Returns
Methods
get()
get<
T>(key):Promise<null|CacheEntry<T>>
Get a value from cache
Type Parameters
T
T
Parameters
key
string
Returns
Promise<null | CacheEntry<T>>
Implementation of
set()
set<
T>(key,value,options?):Promise<void>
Set a value in cache
Type Parameters
T
T
Parameters
key
string
value
T
options?
Returns
Promise<void>
Implementation of
delete()
delete(
key):Promise<boolean>
Delete a value from cache
Parameters
key
string
Returns
Promise<boolean>
Implementation of
has()
has(
key):Promise<boolean>
Check if key exists
Parameters
key
string
Returns
Promise<boolean>
Implementation of
clear()
clear(
pattern?):Promise<number>
Clear cache entries matching pattern
Parameters
pattern?
string
Returns
Promise<number>
Number of entries cleared
Implementation of
keys()
keys(
pattern?):Promise<string[]>
Get all keys matching pattern
Parameters
pattern?
string
Returns
Promise<string[]>
Implementation of
getMany()
getMany<
T>(keys):Promise<Map<string,CacheEntry<T>>>
Get multiple values at once
Type Parameters
T
T
Parameters
keys
string[]
Returns
Promise<Map<string, CacheEntry<T>>>
Implementation of
setMany()
setMany<
T>(entries,options?):Promise<void>
Set multiple values at once
Type Parameters
T
T
Parameters
entries
Map<string, T>
options?
Returns
Promise<void>
Implementation of
getStats()
getStats():
Promise<CacheStats>
Get cache statistics
Returns
Promise<CacheStats>
Implementation of
cleanup()
cleanup():
Promise<number>
Clean up expired entries
Returns
Promise<number>
Number of entries cleaned
Implementation of
destroy()
destroy():
void
Destroy the storage (cleanup resources)
Returns
void