-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
In lru-cache.js, the set function calls "this.get(key)" with no callback when replacing an item. At least in single user mode (possibly always) this will trigger an 'undefined is not a function' exception whenever an item is replaced.
To fix this, a check for the validity of the callback function should be added:
var LRUCacheProxy = function LRUCacheProxy(options) {
if (!(this instanceof LRUCacheProxy)) {
if(cluster.isMaster) {
var lru = new LRUCache(options);
var lruGet = LRUCache.prototype.get;
lru.get = function(key, callback) {
callback && callback(lruGet.apply(lru, arguments));
};
return lru;
}
return new LRUCacheProxy(options);
}
this.namespace = options.namespace || 'default';
send(this.namespace, 'constructor', options, function() {});
};
mickaeltr
Metadata
Metadata
Assignees
Labels
No labels