vsm-dictionary-cacher
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "vsm-dictionary-cacher", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Wrapper around a VSM-dictionary, that manages a cache of string-match results", | ||
@@ -5,0 +5,0 @@ "main": "src/VsmDictionaryCacher.js", |
@@ -35,4 +35,4 @@ /* | ||
this.cacheMaxItems = cacheOptions.maxItems || 0; | ||
this.cacheMaxAge = cacheOptions.maxAge || 0; | ||
this.cacheMOMaxItems = cacheOptions.maxItems || 0; | ||
this.cacheMOMaxAge = cacheOptions.maxAge || 0; | ||
this.cacheMOPredictEmpties = | ||
@@ -139,9 +139,9 @@ (typeof cacheOptions.predictEmpties) === 'undefined' ? true: | ||
* If applicable, restarts a timer for automatically clearing the cache, | ||
* at `cacheMaxAge` milliseconds after any last access to the cache. | ||
* at `cacheMOMaxAge` milliseconds after any last access to the cache. | ||
*/ | ||
_restartCacheMOClearTimer() { | ||
if (this.cacheMaxAge) { | ||
if (this.cacheMOMaxAge) { | ||
clearTimeout(this.cacheMOClearTimer); // Stop it if running already. | ||
this.cacheMOClearTimer = // Start or restart it now. | ||
setTimeout(this.clearCache.bind(this), this.cacheMaxAge); | ||
setTimeout(this.clearCache.bind(this), this.cacheMOMaxAge); | ||
} | ||
@@ -178,3 +178,3 @@ } | ||
var now = getNowTime(); | ||
if (this.cacheMaxAge && now - item.lastAccessed > this.cacheMaxAge) { | ||
if (this.cacheMOMaxAge && now - item.lastAccessed > this.cacheMOMaxAge) { | ||
delete this.cacheMO[key]; // If a req. item expired, evict it from cache. | ||
@@ -200,4 +200,4 @@ return cb(null, null); | ||
// If the cache grew too large, evict the oldest item. | ||
if (this.cacheMaxItems && | ||
Object.keys(this.cacheMO).length > this.cacheMaxItems) { | ||
if (this.cacheMOMaxItems && | ||
Object.keys(this.cacheMO).length > this.cacheMOMaxItems) { | ||
deleteOldestItem(this.cacheMO); | ||
@@ -204,0 +204,0 @@ } |
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
35227