Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,5 @@ | ||
v3.0.1 | ||
------ | ||
* exchange cs (for csr) and lodash (for underscore) - @Kofia5 #8 | ||
v3.0.0 | ||
@@ -2,0 +6,0 @@ ------ |
@@ -0,1 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
@@ -31,29 +33,33 @@ Copyright (c) 2014, Groupon, Inc. | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
*/ | ||
var backend, typeMap; | ||
// Generated by CoffeeScript 2.0.0-beta7 | ||
void function () { | ||
var backend, typeMap; | ||
backend = module.exports = {}; | ||
typeMap = {}; | ||
backend.addType = function (type, klass) { | ||
return typeMap[type] = klass; | ||
}; | ||
backend.create = function (options) { | ||
var klass, type; | ||
if (null != options) | ||
options; | ||
else | ||
options = {}; | ||
if ('function' === typeof options.get && 'function' === typeof options.set) | ||
return options; | ||
type = null != options.type ? options.type : 'noop'; | ||
klass = typeMap[type]; | ||
if (!(null != klass)) | ||
throw new Error('' + type + ' is not a supported cache backend type'); | ||
return new klass(options); | ||
}; | ||
backend.addType('noop', require('./backends/noop')); | ||
backend.addType('memory', require('./backends/memory')); | ||
backend.addType('memcached', require('./backends/memcached')); | ||
}.call(this); | ||
backend = module.exports = {}; | ||
typeMap = {}; | ||
backend.addType = function(type, klass) { | ||
return typeMap[type] = klass; | ||
}; | ||
backend.create = function(options) { | ||
var klass, type, _ref; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
if ('function' === typeof options.get && 'function' === typeof options.set) { | ||
return options; | ||
} | ||
type = (_ref = options.type) != null ? _ref : 'noop'; | ||
klass = typeMap[type]; | ||
if (klass == null) { | ||
throw new Error("" + type + " is not a supported cache backend type"); | ||
} | ||
return new klass(options); | ||
}; | ||
backend.addType('noop', require("./backends/noop")); | ||
backend.addType('memory', require("./backends/memory")); | ||
backend.addType('memcached', require("./backends/memcached")); |
@@ -0,1 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
@@ -31,53 +33,62 @@ Copyright (c) 2014, Groupon, Inc. | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
*/ | ||
var Memcached, MemcachedBackend; | ||
// Generated by CoffeeScript 2.0.0-beta7 | ||
void function () { | ||
var Memcached, MemcachedBackend; | ||
Memcached = require('memcached'); | ||
MemcachedBackend = function () { | ||
var description; | ||
description = 'Uses anything supporting the memcache protocol'; | ||
function MemcachedBackend(options) { | ||
var hosts; | ||
this.type = 'memcached'; | ||
if (null != options.client) { | ||
this.client = options.client; | ||
Memcached = require('memcached'); | ||
MemcachedBackend = (function() { | ||
var description; | ||
description = "Uses anything supporting the memcache protocol"; | ||
function MemcachedBackend(options) { | ||
var hosts, _ref; | ||
this.type = 'memcached'; | ||
if (options.client != null) { | ||
this.client = options.client; | ||
} else { | ||
hosts = (_ref = options.hosts) != null ? _ref : '127.0.0.1:11211'; | ||
this.client = new Memcached(hosts, options); | ||
} | ||
} | ||
MemcachedBackend.prototype.get = function(key, callback) { | ||
return this.client.get(key, function(err, answer) { | ||
if (answer === false) { | ||
answer = null; | ||
} | ||
if (err != null) { | ||
return callback(err); | ||
} else { | ||
hosts = null != options.hosts ? options.hosts : '127.0.0.1:11211'; | ||
this.client = new Memcached(hosts, options); | ||
return callback(null, answer); | ||
} | ||
}); | ||
}; | ||
MemcachedBackend.prototype.set = function(key, value, options, callback) { | ||
return this.client.set(key, value, options.expire, function(err, ok) { | ||
if (err != null) { | ||
return callback(err); | ||
} else { | ||
return callback(null, value); | ||
} | ||
}); | ||
}; | ||
MemcachedBackend.prototype.unset = function(key, callback) { | ||
delete this.cache[key]; | ||
if (callback != null) { | ||
callback(null); | ||
} | ||
MemcachedBackend.prototype.get = function (key, callback) { | ||
return this.client.get(key, function (err, answer) { | ||
if (answer === false) | ||
answer = null; | ||
if (null != err) { | ||
return callback(err); | ||
} else { | ||
return callback(null, answer); | ||
} | ||
}); | ||
}; | ||
MemcachedBackend.prototype.set = function (key, value, options, callback) { | ||
return this.client.set(key, value, options.expire, function (err, ok) { | ||
if (null != err) { | ||
return callback(err); | ||
} else { | ||
return callback(null, value); | ||
} | ||
}); | ||
}; | ||
MemcachedBackend.prototype.unset = function (key, callback) { | ||
delete this.cache[key]; | ||
if (null != callback) | ||
callback(null); | ||
return null; | ||
}; | ||
MemcachedBackend.prototype.end = function () { | ||
return this.client.end(); | ||
}; | ||
return MemcachedBackend; | ||
}(); | ||
module.exports = MemcachedBackend; | ||
}.call(this); | ||
return null; | ||
}; | ||
MemcachedBackend.prototype.end = function() { | ||
return this.client.end(); | ||
}; | ||
return MemcachedBackend; | ||
})(); | ||
module.exports = MemcachedBackend; |
@@ -0,1 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
@@ -31,53 +33,67 @@ Copyright (c) 2014, Groupon, Inc. | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
*/ | ||
var MemoryBackend; | ||
// Generated by CoffeeScript 2.0.0-beta7 | ||
void function () { | ||
var MemoryBackend; | ||
MemoryBackend = function () { | ||
var description; | ||
description = 'Stores everything just in memory'; | ||
function MemoryBackend() { | ||
this.cache = {}; | ||
this.type = 'memory'; | ||
MemoryBackend = (function() { | ||
var description; | ||
description = "Stores everything just in memory"; | ||
function MemoryBackend() { | ||
this.cache = {}; | ||
this.type = 'memory'; | ||
} | ||
MemoryBackend.prototype.get = function(key, callback) { | ||
var _ref, _ref1, _ref2; | ||
if (this.isExpired((_ref = this.cache[key]) != null ? _ref.e : void 0)) { | ||
delete this.cache[key]; | ||
} | ||
MemoryBackend.prototype.get = function (key, callback) { | ||
if (this.isExpired(null != this.cache[key] ? this.cache[key].e : void 0)) | ||
delete this.cache[key]; | ||
if (null != callback) | ||
callback(null, null != (null != this.cache[key] ? this.cache[key].d : void 0) ? null != this.cache[key] ? this.cache[key].d : void 0 : null); | ||
return null; | ||
if (callback != null) { | ||
callback(null, (_ref1 = (_ref2 = this.cache[key]) != null ? _ref2.d : void 0) != null ? _ref1 : null); | ||
} | ||
return null; | ||
}; | ||
MemoryBackend.prototype.expiresAt = function(seconds) { | ||
if (seconds === 0) { | ||
return 0; | ||
} else { | ||
return (new Date()).getTime() + (parseInt(seconds) * 1000); | ||
} | ||
}; | ||
MemoryBackend.prototype.isExpired = function(expires) { | ||
if (expires == null) { | ||
return false; | ||
} | ||
if (expires === 0) { | ||
return false; | ||
} | ||
return (new Date()).getTime() > (new Date(expires)).getTime(); | ||
}; | ||
MemoryBackend.prototype.set = function(key, value, options, callback) { | ||
this.cache[key] = { | ||
d: value, | ||
e: this.expiresAt(options.expire) | ||
}; | ||
MemoryBackend.prototype.expiresAt = function (seconds) { | ||
if (seconds === 0) { | ||
return 0; | ||
} else { | ||
return new Date().getTime() + parseInt(seconds) * 1e3; | ||
} | ||
}; | ||
MemoryBackend.prototype.isExpired = function (expires) { | ||
if (!(null != expires)) | ||
return false; | ||
if (expires === 0) | ||
return false; | ||
return new Date().getTime() > new Date(expires).getTime(); | ||
}; | ||
MemoryBackend.prototype.set = function (key, value, options, callback) { | ||
this.cache[key] = { | ||
d: value, | ||
e: this.expiresAt(options.expire) | ||
}; | ||
if (null != callback) | ||
callback(null, value); | ||
return null; | ||
}; | ||
MemoryBackend.prototype.unset = function (key, callback) { | ||
delete this.cache[key]; | ||
if (null != callback) | ||
callback(null); | ||
return null; | ||
}; | ||
return MemoryBackend; | ||
}(); | ||
module.exports = MemoryBackend; | ||
}.call(this); | ||
if (callback != null) { | ||
callback(null, value); | ||
} | ||
return null; | ||
}; | ||
MemoryBackend.prototype.unset = function(key, callback) { | ||
delete this.cache[key]; | ||
if (callback != null) { | ||
callback(null); | ||
} | ||
return null; | ||
}; | ||
return MemoryBackend; | ||
})(); | ||
module.exports = MemoryBackend; |
@@ -0,1 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
@@ -31,25 +33,30 @@ Copyright (c) 2014, Groupon, Inc. | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
*/ | ||
var NoopBackend; | ||
// Generated by CoffeeScript 2.0.0-beta7 | ||
void function () { | ||
var NoopBackend; | ||
NoopBackend = function () { | ||
var description; | ||
description = 'Simple backend doing nothing'; | ||
function NoopBackend() { | ||
this.type = 'noop'; | ||
} | ||
NoopBackend.prototype.get = function (key, callback) { | ||
return callback(null, null); | ||
}; | ||
NoopBackend.prototype.set = function (key, value, options, callback) { | ||
return callback(null, value); | ||
}; | ||
NoopBackend.prototype.unset = function (key, callback) { | ||
return callback(null); | ||
}; | ||
return NoopBackend; | ||
}(); | ||
module.exports = NoopBackend; | ||
}.call(this); | ||
NoopBackend = (function() { | ||
var description; | ||
description = "Simple backend doing nothing"; | ||
function NoopBackend() { | ||
this.type = 'noop'; | ||
} | ||
NoopBackend.prototype.get = function(key, callback) { | ||
return callback(null, null); | ||
}; | ||
NoopBackend.prototype.set = function(key, value, options, callback) { | ||
return callback(null, value); | ||
}; | ||
NoopBackend.prototype.unset = function(key, callback) { | ||
return callback(null); | ||
}; | ||
return NoopBackend; | ||
})(); | ||
module.exports = NoopBackend; |
293
lib/cache.js
@@ -0,1 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
@@ -31,153 +33,160 @@ Copyright (c) 2014, Groupon, Inc. | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
*/ | ||
var Backend, Cache, Q, expiresAt, extend, isExpired, optionalOpts, toPromise; | ||
// Generated by CoffeeScript 2.0.0-beta7 | ||
void function () { | ||
var Backend, Cache, expiresAt, extend, isExpired, optionalOpts, Q, toPromise; | ||
extend = require('underscore').extend; | ||
Q = require('q'); | ||
Backend = require('./backend'); | ||
toPromise = function (val) { | ||
if ('function' === typeof val) { | ||
return Q(val()); | ||
} else { | ||
return Q(val); | ||
} | ||
extend = require('lodash').extend; | ||
Q = require('q'); | ||
Backend = require('./backend'); | ||
toPromise = function(val) { | ||
if ('function' === typeof val) { | ||
return Q(val()); | ||
} else { | ||
return Q(val); | ||
} | ||
}; | ||
expiresAt = function(seconds) { | ||
if (seconds === 0) { | ||
return 0; | ||
} else { | ||
return Date.now() + parseInt(seconds, 10) * 1000; | ||
} | ||
}; | ||
isExpired = function(expires) { | ||
if (expires === 0) { | ||
return false; | ||
} | ||
return Date.now() > new Date(expires).getTime(); | ||
}; | ||
optionalOpts = function(opts, cb) { | ||
if ((cb == null) && 'function' === typeof opts) { | ||
return { | ||
cb: opts, | ||
opts: null | ||
}; | ||
} else { | ||
return { | ||
cb: cb, | ||
opts: opts | ||
}; | ||
} | ||
}; | ||
Cache = (function() { | ||
function Cache(_arg) { | ||
var backend, defaults, name; | ||
backend = _arg.backend, defaults = _arg.defaults, name = _arg.name; | ||
this.defaults = { | ||
freshFor: 0, | ||
expire: 0 | ||
}; | ||
this.name = name || 'default'; | ||
this.prefix = "" + this.name + ":"; | ||
this.staleOrPending = {}; | ||
this.setDefaults(defaults); | ||
this.setBackend(backend); | ||
} | ||
Cache.prototype.applyPrefix = function(key) { | ||
return "" + this.prefix + key; | ||
}; | ||
expiresAt = function (seconds) { | ||
if (seconds === 0) { | ||
return 0; | ||
} else { | ||
return Date.now() + parseInt(seconds, 10) * 1e3; | ||
Cache.prototype.setDefaults = function(defaults) { | ||
return this.defaults = this.prepareOptions(defaults); | ||
}; | ||
Cache.prototype.setBackend = function(backendOptions) { | ||
backendOptions = 'string' === typeof backendOptions ? { | ||
type: backendOptions | ||
} : backendOptions != null ? backendOptions : {}; | ||
this.end(); | ||
return this.backend = Backend.create(backendOptions); | ||
}; | ||
Cache.prototype.end = function() { | ||
var _ref; | ||
if (((_ref = this.backend) != null ? _ref.end : void 0) != null) { | ||
return this.backend.end(); | ||
} | ||
}; | ||
isExpired = function (expires) { | ||
if (expires === 0) | ||
return false; | ||
return Date.now() > new Date(expires).getTime(); | ||
Cache.prototype.prepareOptions = function(options) { | ||
return extend({}, this.defaults, options); | ||
}; | ||
optionalOpts = function (opts, cb) { | ||
if (!(null != cb) && 'function' === typeof opts) { | ||
return { | ||
cb: opts, | ||
opts: null | ||
Cache.prototype.set = function(key, val, opts, cb) { | ||
var backend, _ref; | ||
_ref = optionalOpts(opts, cb), cb = _ref.cb, opts = _ref.opts; | ||
key = this.applyPrefix(key); | ||
backend = this.backend; | ||
opts = this.prepareOptions(opts); | ||
return toPromise(val).then(function(resolvedValue) { | ||
var wrappedValue; | ||
wrappedValue = { | ||
b: expiresAt(opts.freshFor), | ||
d: resolvedValue | ||
}; | ||
} else { | ||
return { | ||
cb: cb, | ||
opts: opts | ||
}; | ||
} | ||
return Q.npost(backend, 'set', [key, wrappedValue, opts]); | ||
}).nodeify(cb); | ||
}; | ||
Cache = function () { | ||
function Cache(param$) { | ||
var backend, cache$, defaults, name; | ||
{ | ||
cache$ = param$; | ||
backend = cache$.backend; | ||
defaults = cache$.defaults; | ||
name = cache$.name; | ||
} | ||
this.defaults = { | ||
freshFor: 0, | ||
expire: 0 | ||
Cache.prototype.getWrapped = function(key) { | ||
return Q.npost(this.backend, 'get', [key]); | ||
}; | ||
Cache.prototype.get = function(rawKey, cb) { | ||
var key; | ||
key = this.applyPrefix(rawKey); | ||
return this.getWrapped(key).then(function(wrappedValue) { | ||
var _ref; | ||
return (_ref = wrappedValue != null ? wrappedValue.d : void 0) != null ? _ref : null; | ||
}).nodeify(cb); | ||
}; | ||
Cache.prototype.getOrElse = function(rawKey, val, opts, cb) { | ||
var handleError, key, refreshValue, verifyFreshness, _ref; | ||
key = this.applyPrefix(rawKey); | ||
_ref = optionalOpts(opts, cb), cb = _ref.cb, opts = _ref.opts; | ||
opts = this.prepareOptions(opts); | ||
refreshValue = (function(_this) { | ||
return function() { | ||
var generatedValue; | ||
generatedValue = toPromise(val); | ||
return _this.set(rawKey, generatedValue, opts).then(function(rawValue) { | ||
var _ref1; | ||
delete _this.staleOrPending[key]; | ||
return (_ref1 = rawValue != null ? rawValue.d : void 0) != null ? _ref1 : null; | ||
}, function(err) { | ||
delete _this.staleOrPending[key]; | ||
return generatedValue != null ? generatedValue : null; | ||
}); | ||
}; | ||
this.name = name || 'default'; | ||
this.prefix = '' + this.name + ':'; | ||
this.staleOrPending = {}; | ||
this.setDefaults(defaults); | ||
this.setBackend(backend); | ||
} | ||
Cache.prototype.applyPrefix = function (key) { | ||
return '' + this.prefix + key; | ||
}; | ||
Cache.prototype.setDefaults = function (defaults) { | ||
return this.defaults = this.prepareOptions(defaults); | ||
}; | ||
Cache.prototype.setBackend = function (backendOptions) { | ||
backendOptions = 'string' === typeof backendOptions ? { type: backendOptions } : null != backendOptions ? backendOptions : {}; | ||
this.end(); | ||
return this.backend = Backend.create(backendOptions); | ||
}; | ||
Cache.prototype.end = function () { | ||
if (null != (null != this.backend ? this.backend.end : void 0)) | ||
return this.backend.end(); | ||
}; | ||
Cache.prototype.prepareOptions = function (options) { | ||
return extend({}, this.defaults, options); | ||
}; | ||
Cache.prototype.set = function (key, val, opts, cb) { | ||
var backend, cache$; | ||
cache$ = optionalOpts(opts, cb); | ||
cb = cache$.cb; | ||
opts = cache$.opts; | ||
key = this.applyPrefix(key); | ||
backend = this.backend; | ||
opts = this.prepareOptions(opts); | ||
return toPromise(val).then(function (resolvedValue) { | ||
var wrappedValue; | ||
wrappedValue = { | ||
b: expiresAt(opts.freshFor), | ||
d: resolvedValue | ||
}; | ||
return Q.npost(backend, 'set', [ | ||
key, | ||
wrappedValue, | ||
opts | ||
]); | ||
}).nodeify(cb); | ||
}; | ||
Cache.prototype.getWrapped = function (key) { | ||
return Q.npost(this.backend, 'get', [key]); | ||
}; | ||
Cache.prototype.get = function (rawKey, cb) { | ||
var key; | ||
key = this.applyPrefix(rawKey); | ||
return this.getWrapped(key).then(function (wrappedValue) { | ||
return null != (null != wrappedValue ? wrappedValue.d : void 0) ? null != wrappedValue ? wrappedValue.d : void 0 : null; | ||
}).nodeify(cb); | ||
}; | ||
Cache.prototype.getOrElse = function (rawKey, val, opts, cb) { | ||
var cache$, handleError, key, refreshValue, verifyFreshness; | ||
key = this.applyPrefix(rawKey); | ||
cache$ = optionalOpts(opts, cb); | ||
cb = cache$.cb; | ||
opts = cache$.opts; | ||
opts = this.prepareOptions(opts); | ||
refreshValue = function (this$) { | ||
return function () { | ||
var generatedValue; | ||
generatedValue = toPromise(val); | ||
return this$.set(rawKey, generatedValue, opts).then(function (this$1) { | ||
return function (rawValue) { | ||
delete this$1.staleOrPending[key]; | ||
return null != (null != rawValue ? rawValue.d : void 0) ? null != rawValue ? rawValue.d : void 0 : null; | ||
}; | ||
}(this$), function (this$1) { | ||
return function (err) { | ||
delete this$1.staleOrPending[key]; | ||
return null != generatedValue ? generatedValue : null; | ||
}; | ||
}(this$)); | ||
}; | ||
}(this); | ||
verifyFreshness = function (this$) { | ||
return function (wrappedValue) { | ||
var expired, hit, loadingNewValue; | ||
hit = null != wrappedValue; | ||
expired = isExpired(null != wrappedValue ? wrappedValue.b : void 0); | ||
loadingNewValue = null != this$.staleOrPending[key]; | ||
if ((!hit || expired) && !loadingNewValue) | ||
this$.staleOrPending[key] = refreshValue(); | ||
return null != (null != wrappedValue ? wrappedValue.d : void 0) ? null != wrappedValue ? wrappedValue.d : void 0 : this$.staleOrPending[key]; | ||
}; | ||
}(this); | ||
handleError = function (error) { | ||
return null; | ||
})(this); | ||
verifyFreshness = (function(_this) { | ||
return function(wrappedValue) { | ||
var expired, hit, loadingNewValue, _ref1; | ||
hit = wrappedValue != null; | ||
expired = isExpired(wrappedValue != null ? wrappedValue.b : void 0); | ||
loadingNewValue = _this.staleOrPending[key] != null; | ||
if ((!hit || expired) && !loadingNewValue) { | ||
_this.staleOrPending[key] = refreshValue(); | ||
} | ||
return (_ref1 = wrappedValue != null ? wrappedValue.d : void 0) != null ? _ref1 : _this.staleOrPending[key]; | ||
}; | ||
return this.getWrapped(key)['catch'](handleError).then(verifyFreshness).nodeify(cb); | ||
})(this); | ||
handleError = function(error) { | ||
return null; | ||
}; | ||
return Cache; | ||
}(); | ||
module.exports = Cache; | ||
}.call(this); | ||
return this.getWrapped(key)["catch"](handleError).then(verifyFreshness).nodeify(cb); | ||
}; | ||
return Cache; | ||
})(); | ||
module.exports = Cache; |
@@ -0,1 +1,3 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
@@ -31,46 +33,58 @@ Copyright (c) 2014, Groupon, Inc. | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
*/ | ||
var Cache, Q, cached, extend, namedCaches; | ||
// Generated by CoffeeScript 2.0.0-beta7 | ||
void function () { | ||
var Cache, cached, extend, namedCaches, Q; | ||
try { | ||
Q = require('../node_modules/q'); | ||
Q.stopUnhandledRejectionTracking(); | ||
} catch (e$) { | ||
Q = require('q'); | ||
try { | ||
Q = require('../node_modules/q'); | ||
Q.stopUnhandledRejectionTracking(); | ||
} catch (_error) { | ||
Q = require('q'); | ||
} | ||
Cache = require('./cache'); | ||
extend = require('lodash').extend; | ||
namedCaches = {}; | ||
cached = function(name, options) { | ||
if (name == null) { | ||
name = "default"; | ||
} | ||
Cache = require('./cache'); | ||
extend = require('underscore').extend; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
options = extend({ | ||
name: name | ||
}, options); | ||
return namedCaches[name] != null ? namedCaches[name] : namedCaches[name] = cached.createCache(options); | ||
}; | ||
cached.createCache = function(options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
return new Cache(options); | ||
}; | ||
cached.dropNamedCaches = function() { | ||
namedCaches = {}; | ||
cached = function (name, options) { | ||
if (null == name) | ||
name = 'default'; | ||
if (null == options) | ||
options = {}; | ||
options = extend({ name: name }, options); | ||
return null != namedCaches[name] ? namedCaches[name] : namedCaches[name] = cached.createCache(options); | ||
return cached; | ||
}; | ||
cached.dropNamedCache = function(name) { | ||
delete namedCaches[name]; | ||
return cached; | ||
}; | ||
cached.knownCaches = function() { | ||
return Object.keys(namedCaches); | ||
}; | ||
cached.deferred = function(fn) { | ||
return function() { | ||
return Q.nfcall(fn); | ||
}; | ||
cached.createCache = function (options) { | ||
if (null == options) | ||
options = {}; | ||
return new Cache(options); | ||
}; | ||
cached.dropNamedCaches = function () { | ||
namedCaches = {}; | ||
return cached; | ||
}; | ||
cached.dropNamedCache = function (name) { | ||
delete namedCaches[name]; | ||
return cached; | ||
}; | ||
cached.knownCaches = function () { | ||
return Object.keys(namedCaches); | ||
}; | ||
cached.deferred = function (fn) { | ||
return function () { | ||
return Q.nfcall(fn); | ||
}; | ||
}; | ||
module.exports = cached; | ||
}.call(this); | ||
}; | ||
module.exports = cached; |
{ | ||
"name": "cached", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Simple access to a cache", | ||
@@ -26,2 +26,3 @@ "main": "lib/cached.js", | ||
"exclude": [ | ||
"lib", | ||
"test" | ||
@@ -32,13 +33,13 @@ ] | ||
"dependencies": { | ||
"underscore": "~1.4.4", | ||
"q": "~0.9.7", | ||
"memcached": "2.0.0" | ||
"lodash": "~2.4.1", | ||
"memcached": "~2.0.0", | ||
"q": "~0.9.7" | ||
}, | ||
"devDependencies": { | ||
"bondjs": "~1.0.0", | ||
"coffee-script-redux": "2.0.0-beta7", | ||
"expect.js": "0.2.0", | ||
"mocha": "1.7.4", | ||
"coffee-script": "~1.8.0", | ||
"expect.js": "~0.2.0", | ||
"mocha": "~2.0.1", | ||
"npub": "0.0.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
29757
1109
491
+ Addedlodash@~2.4.1
+ Addedlodash@2.4.2(transitive)
- Removedunderscore@~1.4.4
- Removedunderscore@1.4.4(transitive)
Updatedmemcached@~2.0.0