Class: LRUCache<T>
LRU cache (least recently used) Source: https://stackoverflow.com/a/46432113
Type parameters
Name |
---|
T |
Constructors
constructor
• new LRUCache<T
>(max?
)
Type parameters
Name |
---|
T |
Parameters
Name | Type | Default value |
---|---|---|
max | number | 10 |
Defined in
packages/core/src/cache.ts:9
Methods
clear
▸ clear(): void
Deletes all values from the cache.
Returns
void
Defined in
packages/core/src/cache.ts:17
get
▸ get(key
): undefined
| T
Returns the value for the given key.
Parameters
Name | Type | Description |
---|---|---|
key | string | The key to retrieve. |
Returns
undefined
| T
The value if found; undefined otherwise.
Defined in
packages/core/src/cache.ts:26
set
▸ set(key
, val
): void
Sets the value for the given key.
Parameters
Name | Type | Description |
---|---|---|
key | string | The key to set. |
val | T | The value to set. |
Returns
void
Defined in
packages/core/src/cache.ts:40
delete
▸ delete(key
): void
Deletes the value for the given key.
Parameters
Name | Type | Description |
---|---|---|
key | string | The key to delete. |
Returns
void
Defined in
packages/core/src/cache.ts:53
keys
▸ keys(): IterableIterator
<string
>
Returns the list of all keys in the cache.
Returns
IterableIterator
<string
>
The array of keys in the cache.
Defined in
packages/core/src/cache.ts:61