MemoryCache class
A basic caching manager that caches to the system memory using a Map.
Signature:
export declare class MemoryCache implements ICache
Implements: ICache
References: ICache
Constructor
new MemoryCache ()
Constructs a new instance of the MemoryCache
class.
Parameters:
Parameter | Type | Description |
---|
Methods
.clear ()
Clears the cache.
Signature:
clear(): void;
Return type: void
.find ()
Finds a value in the cache using a predicate and a filter.
Signature:
find<T>(predicate: (t: T) => boolean): T | undefined;
Parameters:
Parameter | Type | Description |
---|---|---|
predicate | (t: T) = > boolean | The predicate to use to find the value. |
Return type: T | Undefined
.get ()
Gets a value from the cache.
Signature:
get<T>(key: string): T;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | The key of the value to get. |
Return type: T
.has ()
Signature:
has(key: string): boolean;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String |
Return type: Boolean
.keys ()
Fetches all keys in the cache.
Signature:
keys(): string[];
Return type: String
.remove ()
Removes a value from the cache.
Signature:
remove(key: string): void;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | The key of the value to remove. |
Return type: void
.set ()
Sets a value in the cache.
Signature:
set<T>(key: string, value: T): void;
Parameters:
Parameter | Type | Description |
---|---|---|
key | String | The key of the value to set. |
value | T | The value to set. |
Return type: void
.values ()
Fetches all values stored in the cache.
Signature:
values(): any[];
Return type: any
Table of Contents