LRUCache<T>
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / LRUCache
Class: LRUCache<T>
Section titled “Class: LRUCache<T>”Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3195
In-memory LRU cache for proofs Uses a doubly-linked list for O(1) LRU operations
Type Parameters
Section titled “Type Parameters”T = SingleProof
Implements
Section titled “Implements”ILRUCache<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LRUCache<
T>(config?):LRUCache<T>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3209
Parameters
Section titled “Parameters”config?
Section titled “config?”Partial<LRUCacheConfig>
Returns
Section titled “Returns”LRUCache<T>
Methods
Section titled “Methods”get(
key):Promise<CacheLookupResult<T>>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3213
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:3217
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:3221
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:3225
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:3229
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:3233
Get cache statistics
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:3237
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:3241
Add an event listener
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”removeEventListener()
Section titled “removeEventListener()”removeEventListener(
listener):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3245
Remove an event listener
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”getSizeBytes()
Section titled “getSizeBytes()”getSizeBytes():
number
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3249
Get the current size in bytes
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”getEntryCount()
Section titled “getEntryCount()”getEntryCount():
number
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3253
Get the entry count
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”evict()
Section titled “evict()”evict(
count?):number
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3257
Manually trigger eviction
Parameters
Section titled “Parameters”count?
Section titled “count?”number
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”getEntriesLRU()
Section titled “getEntriesLRU()”getEntriesLRU():
CacheEntry<T>[]
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3261
Get entries in LRU order (most recent first)
Returns
Section titled “Returns”CacheEntry<T>[]
Implementation of
Section titled “Implementation of”dispose()
Section titled “dispose()”dispose():
void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3265
Dispose of the cache
Returns
Section titled “Returns”void