diff --git a/lib/cartodb/lru.js b/lib/cartodb/lru.js index 5539adc6..adb8a8f5 100644 --- a/lib/cartodb/lru.js +++ b/lib/cartodb/lru.js @@ -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; \ No newline at end of file +module.exports = LRUCache;