From 4bf962638e48fbfa7d8c14fd4e8cbc97426941bf Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 1 Jul 2016 22:37:13 -0700 Subject: [PATCH] lru. --- lib/bcoin/lru.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/lru.js b/lib/bcoin/lru.js index 8c73fc6c..301d5f40 100644 --- a/lib/bcoin/lru.js +++ b/lib/bcoin/lru.js @@ -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 */