From 5d703dd301cf9eb9373418ec1fb7ecb4a1afbefa Mon Sep 17 00:00:00 2001 From: Jochem Date: Tue, 2 Jun 2015 00:24:28 +0300 Subject: [PATCH] Bugfix: Allow replacing cached items Fixes the issue where in some use cases an error was thrown when replacing a previously set item --- lib/LRUCacheProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/LRUCacheProxy.js b/lib/LRUCacheProxy.js index 26680ce..a8e7dc2 100644 --- a/lib/LRUCacheProxy.js +++ b/lib/LRUCacheProxy.js @@ -28,7 +28,7 @@ var LRUCacheProxy = function LRUCacheProxy(options) { var lruGet = LRUCache.prototype.get; lru.get = function(key, callback) { - callback(lruGet.apply(lru, arguments)); + callback && callback(lruGet.apply(lru, arguments)); }; return lru;