How to use the node-cache.prototype function in node-cache

To help you get started, we’ve selected a few node-cache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lando / lando / lib / cache.js View on Github external
if (this.__del(key)) this.log.debug('Removed key %s from memcache.', key);
    else this.log.debug('Failed to remove key %s from memcache.', key);

    // Also remove file if applicable
    try {
      fs.unlinkSync(path.join(this.cacheDir, key));
    } catch (e) {
      this.log.debug('No file cache with key %s', key);
    }
  };
};

/*
 * Stores the old get method.
 */
Cache.prototype.__get = NodeCache.prototype.get;

/*
 * Stores the old set method.
 */
Cache.prototype.__set = NodeCache.prototype.set;

/*
 * Stores the old del method.
 */
Cache.prototype.__del = NodeCache.prototype.del;

/*
 * Return the class
 */
module.exports = Cache;
github lando / lando / lib / cache.js View on Github external
fs.unlinkSync(path.join(this.cacheDir, key));
    } catch (e) {
      this.log.debug('No file cache with key %s', key);
    }
  };
};

/*
 * Stores the old get method.
 */
Cache.prototype.__get = NodeCache.prototype.get;

/*
 * Stores the old set method.
 */
Cache.prototype.__set = NodeCache.prototype.set;

/*
 * Stores the old del method.
 */
Cache.prototype.__del = NodeCache.prototype.del;

/*
 * Return the class
 */
module.exports = Cache;

node-cache

Simple and fast NodeJS internal caching. Node internal in memory cache like memcached.

MIT
Latest version published 4 years ago

Package Health Score

84 / 100
Full package analysis

Popular node-cache functions