API: cache
Source:
cache/cache.ts
Cache
- Provides a static utility for interacting with a server-side cache facade, enabling simple key-value storage, retrieval, and invalidation operations.
Usage
Classes
Cache
Cache
* Provides a static utility for interacting with a server-side cache facade, enabling
simple key-value storage, retrieval, and invalidation operations.
Methods
contains
contains (key:string):booleanChecks if the cache contains a value for the specified key.
@param key The key to check.
@returns True if the key exists in the cache, false otherwise.
get
get (key:any):any|undefinedRetrieves the value associated with the specified key from the cache.
@param key The key to retrieve.
@returns The cached value, orundefinedif the key is not found.
set
set (key:string, data:any):voidStores a value in the cache under the specified key.
Note: The duration/time-to-live (TTL) is typically configured server-side.
@param key The key to store the data under.
@param data The data to store.
delete
delete (key:string):voidRemoves the key and its associated value from the cache.
@param key The key to delete.
clear
clear ():voidClears all entries from the cache.