Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var inherits = require('util').inherits,
MarshallingError = require('common-errors').helpers
.generateClass('MarshallingError'),
BaseDecorator = require('./BaseDecorator');
module.exports = MarshallDecorator;
/**
* Decorator which takes care of marshalling
* the data to / from the cache.
*
* @param {Cache} cache
* @param {Object} [config]
*/
function MarshallDecorator(cache) {
BaseDecorator.call(this, cache);
}
var crypto = require('crypto'),
once = require('lodash/function/once'),
TimeoutError = require('common-errors').helpers
.generateClass('TimeoutError'),
HUMAN_IVAL_RE = /([\d.]+)\s?(ms|sec|min|hour|day|week|month|year)(?:ond|ute)?s?/,
slice = Array.prototype.slice;
/**
* Create an md5 hash
*
* @param {String} str input
* @returns {String} hash
*/
exports.createHash = function (str) {
return crypto
.createHash('md5')
.update(str.toString())
.digest('hex');
var EventEmitter = require('events').EventEmitter,
MarshallingError = require('common-errors').helpers
.generateClass('MarshallingError'),
inherits = require('util').inherits,
joi = require('joi'),
async = require('async'),
createHash = require('./util').createHash;
module.exports = Cache;
/**
* Basic Redis-backed cache
*
* @param {Object} [config]
* @param {String} [config.namespace]
*/
function Cache(client, config) {