fixed lru cache
This commit is contained in:
parent
9c5718a427
commit
e5da826b94
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user