CacheProvider
@blobs/sdk / cache / CacheProvider
Defined in: cache/CacheProvider.ts:9
Pluggable cache provider contract.
The SDK supports multiple cache backends (MemoryCache, LocalStorageCache) behind this interface. CacheManager accepts any implementation, so consumers can plug in custom storage (IndexedDB, Redis-over-HTTP, etc.) by implementing the four core methods.
Methods
get()
get<
T>(key):Promise<T|null>
Defined in: cache/CacheProvider.ts:17
Reads a value from the cache.
Type Parameters
T
T = any
Expected entry value type.
Parameters
key
string
Fully-qualified cache key.
Returns
Promise<T | null>
The cached value, or null if missing or expired.
set()
set<
T>(key,value,ttl?):Promise<void>
Defined in: cache/CacheProvider.ts:27
Writes a value into the cache.
Type Parameters
T
T = any
Value type being stored.
Parameters
key
string
Fully-qualified cache key.
value
T
The value to store.
ttl?
number
Time-to-live in milliseconds; falls back to the provider’s default if omitted.
Returns
Promise<void>
remove()
remove(
key):Promise<void>
Defined in: cache/CacheProvider.ts:34
Removes a single key from the cache.
Parameters
key
string
The cache key to remove.
Returns
Promise<void>
clear()
clear():
Promise<void>
Defined in: cache/CacheProvider.ts:39
Removes every key owned by this provider.
Returns
Promise<void>
has()
has(
key):Promise<boolean>
Defined in: cache/CacheProvider.ts:47
Reports whether a key currently has a non-expired entry.
Parameters
key
string
The cache key to probe.
Returns
Promise<boolean>
true when an unexpired entry exists, otherwise false.
keys()
keys(
pattern?):Promise<string[]>
Defined in: cache/CacheProvider.ts:55
Lists keys owned by this provider, optionally filtered by substring.
Parameters
pattern?
string
Optional substring; only keys containing this string are returned.
Returns
Promise<string[]>
The matching keys.