FileCache<T>
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / FileCache
Class: FileCache<T>
Section titled “Class: FileCache<T>”Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3365
File-based persistent cache for Node.js
Type Parameters
Section titled “Type Parameters”T = SingleProof
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FileCache<
T>(config?):FileCache<T>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3376
Parameters
Section titled “Parameters”config?
Section titled “config?”Partial<PersistentCacheConfig>
Returns
Section titled “Returns”FileCache<T>
Methods
Section titled “Methods”initialize()
Section titled “initialize()”initialize():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3380
Initialize the file-based storage
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”close()
Section titled “close()”close():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3384
Close the file cache (no-op for files)
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”isAvailable()
Section titled “isAvailable()”isAvailable():
boolean
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3388
Check if file system is available
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”getStorageInfo()
Section titled “getStorageInfo()”getStorageInfo():
Promise<{used:number;available:number;quota:number; }>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3392
Get storage usage information
Returns
Section titled “Returns”Promise<{ used: number; available: number; quota: number; }>
Implementation of
Section titled “Implementation of”IPersistentCache.getStorageInfo
compact()
Section titled “compact()”compact():
Promise<void>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3400
Compact the storage (remove expired entries)
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”get(
key):Promise<CacheLookupResult<T>>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3404
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:3408
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:3412
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:3416
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:3420
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:3424
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:3428
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:3429
Add an event listener
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IPersistentCache.addEventListener
removeEventListener()
Section titled “removeEventListener()”removeEventListener(
listener):void
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:3430
Remove an event listener
Parameters
Section titled “Parameters”listener
Section titled “listener”Returns
Section titled “Returns”void