LruCache
A cache that discards the least recently used items first.
This feature is used by the Session to store the result of cacheable actions (Action.isCacheable).
Constructor Summary
| Public Constructor | ||
| public |
constructor(size: number, lifespan: number) Creates an LruCache |
|
Member Summary
| Public Members | ||
| public get |
Returns the number of items held by the cache |
|
| public get |
Returns the lifespan for the values held by the cache in seconds |
|
| public get |
Returns the size of the cache in bytes |
|
Method Summary
| Public Methods | ||
| public |
Resets the cache by flushing it |
|
| public |
Returns the value from the lru cache based on the input Action.id, otherwise if the id is not found under the cache then returns undefined |
|
| public |
Returns a boolean telling if the input key is under the cache |
|
| public |
Returns a list containing the keys of the values held by the cache |
|
| public |
Sets a result value to the lru cache, this value is associated with the Action.id |
|
Public Constructors
Public Members
Public Methods
public flush(key: string) source
Resets the cache by flushing it
Params:
| Name | Type | Attribute | Description |
| key | string |
|
id associated with the value otherwise flushes the whole cache |
public get(key: string, defaultValue: *): * source
Returns the value from the lru cache based on the input Action.id, otherwise if the id is not found under the cache then returns undefined
Params:
| Name | Type | Attribute | Description |
| key | string | id associated with the value |
|
| defaultValue | * |
|
value returned in case the key does not exist |
Return:
| * |
public has(key: string): boolean source
Returns a boolean telling if the input key is under the cache
Params:
| Name | Type | Attribute | Description |
| key | string | id associated with the value |