Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vsm-dictionary-cacher

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vsm-dictionary-cacher - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc