Skip to content

FileCache<T>

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / FileCache

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

File-based persistent cache for Node.js

T = SingleProof

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

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

Partial<PersistentCacheConfig>

FileCache<T>

initialize(): Promise<void>

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

Initialize the file-based storage

Promise<void>

IPersistentCache.initialize


close(): Promise<void>

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

Close the file cache (no-op for files)

Promise<void>

IPersistentCache.close


isAvailable(): boolean

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

Check if file system is available

boolean

IPersistentCache.isAvailable


getStorageInfo(): Promise<{ used: number; available: number; quota: number; }>

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

Get storage usage information

Promise<{ used: number; available: number; quota: number; }>

IPersistentCache.getStorageInfo


compact(): Promise<void>

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

Compact the storage (remove expired entries)

Promise<void>

IPersistentCache.compact


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

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

Get an entry from the cache

string | CacheKey

Promise<CacheLookupResult<T>>

IPersistentCache.get


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

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

Set an entry in the cache

string | CacheKey

T

number

Promise<boolean>

IPersistentCache.set


delete(key): Promise<boolean>

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

Delete an entry from the cache

string | CacheKey

Promise<boolean>

IPersistentCache.delete


has(key): Promise<boolean>

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

Check if an entry exists

string | CacheKey

Promise<boolean>

IPersistentCache.has


clear(): Promise<void>

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

Clear all entries

Promise<void>

IPersistentCache.clear


getStats(): ProofCacheStats

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

Get cache statistics

ProofCacheStats

IPersistentCache.getStats


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

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

Get all keys matching a pattern

string

Promise<string[]>

IPersistentCache.keys


addEventListener(listener): void

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

Add an event listener

CacheEventListener

void

IPersistentCache.addEventListener


removeEventListener(listener): void

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

Remove an event listener

CacheEventListener

void

IPersistentCache.removeEventListener