keyv-lru3.0.1 • Public • Published
Keyv - LRU
This project is part of the Keyv suite.
In order to use LRU as your store in Keyv you will need to:
Install this module in your project:
yarn add keyv-lru
Create your Keyv object by executing:
const KeyvLru KeyvLruManagedTtl = ;const options =max: 1000notify: falsettl: 0expire: 0;const keyvLru = options;const keyvLruManagedTtl = options;
tiny-lru to learn about the
KeyvLruManagedTtl uses a managed TTL strategy instead of timers. This is useful for serverless architectures. tiny-lru expires entries based on timers, that means that the event loop is not empty when the lambda function is finished. That blocks the end of the execution.
This implementation will store the expiration time along with the cached data
and it will deleter expired items upon retrieval. Alternatively there is an
evictExpired() method that will evict all the expired items.
Even when not using
tiny-lru‘s built-in expiration system based on timers, we
still benefit a lot from the LRU store.
keyv-lru is MIT licensed.