TLRU-Cache
Time aware least recently used cache store
Installation
npm i tlru-cache
Usage
; ; ;// won't calculate again;
Documentation
Constructor object properties:
Name | Type | Default value | Description |
---|---|---|---|
maxStoreSize | number | 1000 | Store capacity |
maxAgeMs | number | 60 * 60 * 1000 (1 hour) | Record time to use in milliseconds. Put <= 0 for non-expiring records. |
Methods:
getkey: TKey, calculate:TValue, maxAgeMs: number = null: TValue
Arguments:
-
key: record key
-
calculate: function to get record. receive key as argument
-
maxAgeMs: record time to use. if presented, override constructor option