Core cache interface that all cache implementations must conform to. Provides async operations for getting, setting, and managing cached data.
const cache: ICache<string> = new MemoryCache();await cache.set('key', 'value');const value = await cache.get('key'); // 'value' Copy
const cache: ICache<string> = new MemoryCache();await cache.set('key', 'value');const value = await cache.get('key'); // 'value'
The type of values stored in the cache
Cache configuration
Removes all entries from the cache.
Removes a specific key from the cache.
The cache key to delete
True if the key was successfully deleted
Retrieves a value from the cache by key.
The cache key to retrieve
The cached value or null if not found or expired
Checks if a key exists in the cache and is not expired.
The cache key to check
True if the key exists and is valid
Returns all keys currently stored in the cache.
Array of all cache keys
Stores a value in the cache with optional configuration.
The cache key to store under
The value to cache
Optional
Optional caching configuration (TTL, metadata)
Returns the number of entries in the cache.
Current cache size
Core cache interface that all cache implementations must conform to. Provides async operations for getting, setting, and managing cached data.
Example