MultiTierCache<T>
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / MultiTierCache
Class: MultiTierCache<T>
Section titled “Class: MultiTierCache<T>”Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3461
Multi-tier cache combining in-memory LRU with optional persistent storage
Type Parameters
Section titled “Type Parameters”T = SingleProof
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MultiTierCache<
T>(config?,persistentConfig?):MultiTierCache<T>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3471
Parameters
Section titled “Parameters”config?
Section titled “config?”Partial<MultiTierCacheConfig>
persistentConfig?
Section titled “persistentConfig?”Partial<PersistentCacheConfig>
Returns
Section titled “Returns”MultiTierCache<T>
Methods
Section titled “Methods”initialize()
Section titled “initialize()”initialize():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3475
Initialize the multi-tier cache
Returns
Section titled “Returns”Promise<void>
get(
key):Promise<CacheLookupResult<T>>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3479
Get an entry from the cache
Parameters
Section titled “Parameters”string | CacheKey
Returns
Section titled “Returns”Promise<CacheLookupResult<T>>
Implementation of
Section titled “Implementation of”set(
key,value,ttlMs?):Promise<boolean>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3483
Set an entry in the cache
Parameters
Section titled “Parameters”string | CacheKey
T
ttlMs?
Section titled “ttlMs?”number
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”delete()
Section titled “delete()”delete(
key):Promise<boolean>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3487
Delete an entry from the cache
Parameters
Section titled “Parameters”string | CacheKey
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”has(
key):Promise<boolean>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3491
Check if an entry exists
Parameters
Section titled “Parameters”string | CacheKey
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3495
Clear all entries
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”getStats()
Section titled “getStats()”getStats():
ProofCacheStats
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3499
Get cache statistics (combined from both tiers)
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”keys()
Section titled “keys()”keys(
pattern?):Promise<string[]>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3503
Get all keys matching a pattern
Parameters
Section titled “Parameters”pattern?
Section titled “pattern?”string
Returns
Section titled “Returns”Promise<string[]>
Implementation of
Section titled “Implementation of”addEventListener()
Section titled “addEventListener()”addEventListener(
listener):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3504
Add an event listener
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IMultiTierCache.addEventListener
removeEventListener()
Section titled “removeEventListener()”removeEventListener(
listener):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3505
Remove an event listener
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IMultiTierCache.removeEventListener
getMemoryCache()
Section titled “getMemoryCache()”getMemoryCache():
ILRUCache<T>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3509
Get the memory cache tier
Returns
Section titled “Returns”ILRUCache<T>
Implementation of
Section titled “Implementation of”IMultiTierCache.getMemoryCache
getPersistentCache()
Section titled “getPersistentCache()”getPersistentCache():
IPersistentCache<T> |null
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3513
Get the persistent cache tier (if available)
Returns
Section titled “Returns”IPersistentCache<T> | null
Implementation of
Section titled “Implementation of”IMultiTierCache.getPersistentCache
warm()
Section titled “warm()”warm(
keys):Promise<WarmingResult>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3517
Warm the cache with specific keys
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<WarmingResult>
Implementation of
Section titled “Implementation of”startWarming()
Section titled “startWarming()”startWarming(
config?,generator?):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3521
Start automatic cache warming
Parameters
Section titled “Parameters”config?
Section titled “config?”generator?
Section titled “generator?”(key) => Promise<T>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”stopWarming()
Section titled “stopWarming()”stopWarming():
void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3525
Stop automatic cache warming
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”invalidate()
Section titled “invalidate()”invalidate(
rules):Promise<number>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3529
Apply invalidation rules
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<number>
Implementation of
Section titled “Implementation of”dispose()
Section titled “dispose()”dispose():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3533
Dispose of the cache
Returns
Section titled “Returns”Promise<void>