lru.
This commit is contained in:
parent
996bbc6b21
commit
4bf962638e
@ -147,7 +147,7 @@ LRU.prototype.set = function set(key, value) {
|
||||
return;
|
||||
}
|
||||
|
||||
item = { key: key, value: value };
|
||||
item = new LRUItem(key, value);
|
||||
|
||||
this.data[key] = item;
|
||||
|
||||
@ -307,6 +307,21 @@ LRU.prototype.toArray = function toArray() {
|
||||
return items;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents an LRU item.
|
||||
* @constructor
|
||||
* @private
|
||||
* @param {String} key
|
||||
* @param {Object} value
|
||||
*/
|
||||
|
||||
function LRUItem(key, value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.next = null;
|
||||
this.prev = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user