fixed lru cache

This commit is contained in:
javi 2011-10-21 17:41:41 +02:00
parent 9c5718a427
commit e5da826b94

View File

@ -170,7 +170,10 @@ LRUCache.prototype.remove = function(key) {
entry.older.newer = undefined;
// link the newer entry to head
this.tail = entry.older;
} else {
this.head = this.tail = undefined;
}
this.size--;
return entry.value;
}
@ -246,4 +249,4 @@ LRUCache.prototype.toString = function() {
// Export ourselves
//if (typeof this === 'object') this.LRUCache = LRUCache;
module.exports = LRUCache;
module.exports = LRUCache;