Skip to content

Commit

Permalink
Merge pull request #3 from mjor/lru-update
Browse files Browse the repository at this point in the history
Update LRU cache on item retrieval (hacky)
  • Loading branch information
Paul Serby committed Aug 7, 2012
2 parents 511341a + 0374802 commit fdf5cc8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/cache.js
Expand Up @@ -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;
},
Expand Down

0 comments on commit fdf5cc8

Please sign in to comment.