ICache interface
The base cache interface for the cache plugin to be used.
Signature:
export interface ICache
Methods
.clear ()
Clear the cache.
Signature:
clear(): Promise<any> | void;
Return type: Promise < any > | void
.find ()
Find a value in the cache using a predicate and a filter.
Signature:
find<T>(predicate: (t: T) => boolean): Promise<T> | T | undefined;
Parameters:
Parameter | Type | Description |
---|---|---|
predicate | (t: T) = > boolean | The predicate to use to find the value. |
Return type: Promise < T > | T | Undefined
.get ()
Get a value from the cache.
Signature:
get<T>(key: string): Promise<T> | T;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | The key of the value to get. |
Return type: Promise < T > | T
.has ()
Signature:
has(key: string): Promise<boolean> | boolean;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String |
Return type: Promise < Boolean > | Boolean
.keys ()
Fetches all keys in the cache.
Signature:
keys(): Promise<string[]> | string[];
Return type: Promise < String > | String
.remove ()
Remove a value from the cache.
Signature:
remove(key: string): Promise<any> | void;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | The key of the value to remove. |
Return type: Promise < any > | void
.set ()
Set a value in the cache.
Signature:
set<T>(key: string, value: T): Promise<any> | void;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | The key of the value to set. |
value | T | The value to set. |
Return type: Promise < any > | void
.values ()
Fetches all values stored in the cache.
Signature:
values(): Promise<any[]> | any[];
Return type: Promise < any > | any