lru-cache
Advanced tools
Comparing version 2.6.0 to 2.6.1
@@ -151,8 +151,12 @@ ;(function () { // closure for web browsers | ||
LRUCache.prototype.set = function (key, value, maxAge) { | ||
maxAge = maxAge || this._maxAge | ||
var now = maxAge ? Date.now() : 0 | ||
if (hOP(this._cache, key)) { | ||
// dispose of the old one before overwriting | ||
if (this._dispose) this._dispose(key, this._cache[key].value) | ||
if (maxAge || this._maxAge) this._cache[key].now = Date.now() | ||
delete this._cache[key]['maxAge'] | ||
if (maxAge) this._cache[key].maxAge = maxAge | ||
if (this._dispose) | ||
this._dispose(key, this._cache[key].value) | ||
this._cache[key].now = now | ||
this._cache[key].maxAge = maxAge | ||
this._cache[key].value = value | ||
@@ -164,4 +168,2 @@ this.get(key) | ||
var len = this._lengthCalculator(value) | ||
var now = (maxAge || this._maxAge) ? Date.now() : 0 | ||
var maxAge = maxAge || this._maxAge | ||
var hit = new Entry(key, value, this._mru++, len, now, maxAge) | ||
@@ -179,3 +181,5 @@ | ||
if (this._length > this._max) trim(this) | ||
if (this._length > this._max) | ||
trim(this) | ||
return true | ||
@@ -182,0 +186,0 @@ } |
{ | ||
"name": "lru-cache", | ||
"description": "A cache object that deletes the least-recently-used items.", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"author": "Isaac Z. Schlueter <i@izs.me>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
727
24444