Permalink
Browse files

Merge pull request #3 from mjor/lru-update

Update LRU cache on item retrieval (hacky)
  • Loading branch information...
2 parents 511341a + 0374802 commit fdf5cc8aa3ccff18314fdfa94f65fb4387eb6082 @serby committed Aug 7, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/cache.js
View
5 lib/cache.js
@@ -79,6 +79,11 @@ module.exports = function(options) {
if ((item) && ((!item.expire) || (item.expire) && (item.expire >= Date.now()))) {
response = item.value;
+
+ delete lru[item.lruId];
+ lru[lruId] = key;
+ item.lruId = lruId;
+ lruId++;
}
return response;
},

0 comments on commit fdf5cc8

Please sign in to comment.