Interface: MaximCache
Defined in: src/lib/cache/cache.ts:41 Cache interface for the Maxim SDK. This interface defines the contract for cache implementations used by the Maxim SDK to store and retrieve cache across distributed systems. Implementations can use in-memory storage, Redis, file systems, or any other persistence mechanism. MaximCacheExamples
Methods
delete()
delete(Defined in: src/lib/cache/cache.ts:89 Removes a key and its associated value from the cache.key):Promise<void>
Parameters
key
string
The cache key to delete. Must be a non-empty string.
Returns
Promise<void>
A promise that resolves when the key is successfully deleted.
Throws
When the cache operation fails or is inaccessible.Example
get()
get(Defined in: src/lib/cache/cache.ts:65 Retrieves a value from the cache for the given key.key):Promise<null|string>
Parameters
key
string
The cache key to retrieve. Must be a non-empty string.
Returns
Promise<null | string>
The cached value as a string, or null if the key doesn’t exist.
Throws
When the cache operation fails or is inaccessible.Example
getAllKeys()
getAllKeys():Defined in: src/lib/cache/cache.ts:51 Retrieves all keys currently stored in the cache.Promise<string[]>
Returns
Promise<string[]>
An array of all cache keys.
Throws
When the cache operation fails or is inaccessible.Example
set()
set(Defined in: src/lib/cache/cache.ts:77 Stores a value in the cache with the specified key.key,value):Promise<void>
Parameters
key
string
The cache key to store under. Must be a non-empty string.
value
string
The string value to cache. Will be stored as-is.
Returns
Promise<void>
A promise that resolves when the value is successfully stored.