diff --git a/.emdaer/.offline/plugin-contributors-details-github/contributors-data.json b/.emdaer/.offline/plugin-contributors-details-github/contributors-data.json index eae7f23..10cbf9f 100644 --- a/.emdaer/.offline/plugin-contributors-details-github/contributors-data.json +++ b/.emdaer/.offline/plugin-contributors-details-github/contributors-data.json @@ -27,9 +27,9 @@ "bio": "Engineer and programmer focused on online applications.", "public_repos": 67, "public_gists": 35, - "followers": 83, + "followers": 86, "following": 45, "created_at": "2011-10-20T14:27:43Z", - "updated_at": "2018-05-31T14:20:57Z" + "updated_at": "2018-06-22T10:20:03Z" } ] diff --git a/.emdaer/docs/install.md b/.emdaer/docs/install.md index fd38bc4..9cbc464 100644 --- a/.emdaer/docs/install.md +++ b/.emdaer/docs/install.md @@ -16,6 +16,8 @@ module. This is one of the [best performing libraries for LRU storages](https:// Create your Keyv object by executing: ```js +const { KeyvLru, KeyvLruManagedTtl } = require('keyv-lru'); + const options = { max: 1000, notify: false, @@ -23,7 +25,21 @@ const options = { expire: 0, }; const keyvLru = new KeyvLru(options); +const keyvLruManagedTtl = new KeyvLruManagedTtl(options); ``` See [`tiny-lru`](https://www.npmjs.com/package/tiny-lru) to learn about the available options. + +## Managed TTLs +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. diff --git a/README.md b/README.md index a85a1c9..d504b1b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ -->
tiny-lru
to learn about the
available options.
+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.