We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 393fc22 commit 1d8afd9Copy full SHA for 1d8afd9
src/lru-cache.js
@@ -0,0 +1,25 @@
1
+const lru = require('lru-cache');
2
+
3
+module.exports = class LRU {
4
+ constructor({ maxItems }) {
5
+ this.cache = lru(maxItems);
6
+ }
7
8
+ get(key) {
9
+ return Promise.resolve(this.cache.get(key));
10
11
12
+ set(key, value, options) {
13
+ const { maxAge } = options || {};
14
+ this.cache.set(key, value, maxAge);
15
+ return Promise.resolve(key);
16
17
18
+ values() {
19
+ return Promise.resolve(this.cache.values());
20
21
22
+ length() {
23
+ return this.cache.length;
24
25
+};
0 commit comments