lru-cache
Advanced tools
+1
-1
| { | ||
| "name": "lru-cache", | ||
| "description": "A cache object that deletes the least-recently-used items.", | ||
| "version": "4.1.1", | ||
| "version": "4.1.2", | ||
| "author": "Isaac Z. Schlueter <i@izs.me>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
+7
-1
@@ -28,6 +28,12 @@ # lru cache | ||
| // non-string keys ARE fully supported | ||
| var someObject = {} | ||
| // but note that it must be THE SAME object, not | ||
| // just a JSON-equivalent object. | ||
| var someObject = { a: 1 } | ||
| cache.set(someObject, 'a value') | ||
| // Object keys are not toString()-ed | ||
| cache.set('[object Object]', 'a different value') | ||
| assert.equal(cache.get(someObject), 'a value') | ||
| // A similar object with same keys/values won't work, | ||
| // because it's a different object identity | ||
| assert.equal(cache.get({ a: 1 }), undefined) | ||
@@ -34,0 +40,0 @@ cache.reset() // empty the cache |
17609
1.55%159
3.92%