You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lrujs is a fast and lightweight least-recently-used cache for [Node.js](http://nodejs.org)
7
+
Lrujs is a fast and lightweight lru (least-recently-used) caching library for javascript.
8
+
9
+
A LRU (least-recently-used) cache will automatically removes the least recently used data from cache when a new data is added to the cache and cache is full.
10
+
11
+
Lrujs support TTL (Time to live) and max cache size feature.
12
+
The default value for maxSize is 1000 and TTL is 0 milliseconds (0 means permanently), if you not set the max cache size and ttl then the default values are used.
13
+
14
+
Lrujs is also support TTL, but it is not a TTL cache, and does not make strong TTL guarantees. Lrujs will not automatically removes the expired items, but you can set a default TTL on the cache or on a single value. If you do so, it will treat expired items as missing, and delete them when they are fetched. You can set TTL in milliseconds.
Lrujs is a fast and lightweight caching library for javascript, lrujs support TTL (Time to live) and max cache size feature.
58
-
The default value for maxSize is 1000 and TTL is 0 milliseconds (0 means permanently), if you not set the max cache size and ttl then the default values are used.
59
-
60
-
Lrujs is also support TTL, but it is not a TTL cache, and does not make strong TTL guarantees. Lrujs will not automatically removes the expired items, but you can set a default TTL on the cache or on a single value. If you do so, it will treat expired items as missing, and delete them when they are fetched. You can set TTL in milliseconds.
61
-
62
-
#### Create a cache object:
62
+
## Create a new cache object
63
63
64
64
```js
65
65
constLRUCache=require("@opensnip/lrujs");
@@ -71,7 +71,7 @@ const cache = new LRUCache({
71
71
});
72
72
```
73
73
74
-
####Set a new data:
74
+
## Set a new data
75
75
76
76
In lrujs any value (both objects and primitive values) may be used as either a key or a value.
77
77
@@ -83,7 +83,7 @@ cache.set("a", 10);
83
83
cache.set("b", 10, { ttl:200 }); // Expires after 200 ms
0 commit comments