record-cache
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -82,2 +82,3 @@ var EMPTY = [] | ||
this._interval = null | ||
this._gced = false | ||
@@ -87,3 +88,3 @@ if (this.maxAge && this.maxAge < Infinity) { | ||
var tick = Math.ceil(2 / 3 * this.maxAge) | ||
this._interval = setInterval(this._gc.bind(this), tick) | ||
this._interval = setInterval(this._gcAuto.bind(this), tick) | ||
if (this._interval.unref) this._interval.unref() | ||
@@ -136,2 +137,7 @@ } | ||
RecordCache.prototype._gcAuto = function () { | ||
if (!this._gced) this._gc() | ||
this._gced = false | ||
} | ||
RecordCache.prototype._gc = function () { | ||
@@ -141,2 +147,3 @@ if (this._onstale && this._stale.size > 0) this._onstale(this._stale) | ||
this._fresh = new RecordStore() | ||
this._gced = true | ||
} | ||
@@ -143,0 +150,0 @@ |
{ | ||
"name": "record-cache", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Cache optimised for record like things", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
11697
297