Skip to content

LRUCache<T>

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / LRUCache

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

T = SingleProof

new LRUCache<T>(config?): LRUCache<T>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3209

Partial<LRUCacheConfig>

LRUCache<T>

get(key): Promise<CacheLookupResult<T>>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3213

Get an entry from the cache

string | CacheKey

Promise<CacheLookupResult<T>>

ILRUCache.get


set(key, value, ttlMs?): Promise<boolean>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3217

Set an entry in the cache

string | CacheKey

T

number

Promise<boolean>

ILRUCache.set


delete(key): Promise<boolean>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3221

Delete an entry from the cache

string | CacheKey

Promise<boolean>

ILRUCache.delete


has(key): Promise<boolean>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3225

Check if an entry exists

string | CacheKey

Promise<boolean>

ILRUCache.has


clear(): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3229

Clear all entries

Promise<void>

ILRUCache.clear


getStats(): ProofCacheStats

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3233

Get cache statistics

ProofCacheStats

ILRUCache.getStats


keys(pattern?): Promise<string[]>

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3237

Get all keys matching a pattern

string

Promise<string[]>

ILRUCache.keys


addEventListener(listener): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3241

Add an event listener

CacheEventListener

void

ILRUCache.addEventListener


removeEventListener(listener): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3245

Remove an event listener

CacheEventListener

void

ILRUCache.removeEventListener


getSizeBytes(): number

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3249

Get the current size in bytes

number

ILRUCache.getSizeBytes


getEntryCount(): number

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3253

Get the entry count

number

ILRUCache.getEntryCount


evict(count?): number

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3257

Manually trigger eviction

number

number

ILRUCache.evict


getEntriesLRU(): CacheEntry<T>[]

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3261

Get entries in LRU order (most recent first)

CacheEntry<T>[]

ILRUCache.getEntriesLRU


dispose(): void

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3265

Dispose of the cache

void

ILRUCache.dispose