node-cache
Advanced tools
Comparing version 3.2.0 to 3.2.1
11
index.js
@@ -0,1 +1,10 @@ | ||
/* | ||
* node-cache 3.2.1 ( 2016-03-21 ) | ||
* https://github.com/tcs-de/nodecache | ||
* | ||
* Released under the MIT license | ||
* https://github.com/tcs-de/nodecache/blob/master/LICENSE | ||
* | ||
* Maintained by M. Peter ( https://github.com/mpneuried ) | ||
*/ | ||
(function() { | ||
@@ -6,4 +15,4 @@ var exports; | ||
exports.version = '3.2.0'; | ||
exports.version = '3.2.1'; | ||
}).call(this); |
@@ -0,3 +1,12 @@ | ||
/* | ||
* node-cache 3.2.1 ( 2016-03-21 ) | ||
* https://github.com/tcs-de/nodecache | ||
* | ||
* Released under the MIT license | ||
* https://github.com/tcs-de/nodecache/blob/master/LICENSE | ||
* | ||
* Maintained by M. Peter ( https://github.com/mpneuried ) | ||
*/ | ||
(function() { | ||
var EventEmitter, NodeCache, _, clone, | ||
var EventEmitter, NodeCache, _assignIn, _isArray, _isFunction, _isNumber, _isObject, _isString, _size, _template, clone, | ||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
@@ -8,4 +17,18 @@ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
_ = require("lodash"); | ||
_assignIn = require("lodash/assignIn"); | ||
_isArray = require("lodash/isArray"); | ||
_isString = require("lodash/isString"); | ||
_isFunction = require("lodash/isFunction"); | ||
_isNumber = require("lodash/isNumber"); | ||
_isObject = require("lodash/isObject"); | ||
_size = require("lodash/size"); | ||
_template = require("lodash/template"); | ||
clone = require("clone"); | ||
@@ -38,3 +61,3 @@ | ||
this.data = {}; | ||
this.options = _.extend({ | ||
this.options = _assignIn({ | ||
forceString: false, | ||
@@ -93,3 +116,3 @@ objectValueSize: 80, | ||
var _err, i, key, len, oRet; | ||
if (!_.isArray(keys)) { | ||
if (!_isArray(keys)) { | ||
_err = this._error("EKEYSTYPE"); | ||
@@ -120,6 +143,6 @@ if (cb != null) { | ||
existend = false; | ||
if (this.options.forceString && !_.isString(value)) { | ||
if (this.options.forceString && !_isString(value)) { | ||
value = JSON.stringify(value); | ||
} | ||
if (arguments.length === 3 && _.isFunction(ttl)) { | ||
if (arguments.length === 3 && _isFunction(ttl)) { | ||
cb = ttl; | ||
@@ -147,3 +170,3 @@ ttl = this.options.stdTTL; | ||
var delCount, i, key, len, oldVal; | ||
if (_.isString(keys)) { | ||
if (_isString(keys)) { | ||
keys = [keys]; | ||
@@ -350,12 +373,12 @@ } | ||
NodeCache.prototype._getValLength = function(value) { | ||
if (_.isString(value)) { | ||
if (_isString(value)) { | ||
return value.length; | ||
} else if (this.options.forceString) { | ||
return JSON.stringify(value).length; | ||
} else if (_.isArray(value)) { | ||
} else if (_isArray(value)) { | ||
return this.options.arrayValueSize * value.length; | ||
} else if (_.isNumber(value)) { | ||
} else if (_isNumber(value)) { | ||
return 8; | ||
} else if (_.isObject(value)) { | ||
return this.options.objectValueSize * _.size(value); | ||
} else if (_isObject(value)) { | ||
return this.options.objectValueSize * _size(value); | ||
} else { | ||
@@ -376,3 +399,3 @@ return 0; | ||
error.data = data; | ||
if (cb && _.isFunction(cb)) { | ||
if (cb && _isFunction(cb)) { | ||
cb(error, null); | ||
@@ -390,3 +413,3 @@ } else { | ||
_errMsg = ref[_errT]; | ||
this.ERRORS[_errT] = _.template(_errMsg); | ||
this.ERRORS[_errT] = _template(_errMsg); | ||
} | ||
@@ -393,0 +416,0 @@ }; |
@@ -6,4 +6,9 @@ { | ||
"tags": [ "cache", "caching", "local", "variable", "multi", "memory", "internal", "node", "memcached", "object" ], | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"author": "tcs-de <github@tcs.de>", | ||
"maintainers": { | ||
"name" : "M. Peter", | ||
"email" : "mp@tcs.de", | ||
"url" : "https://github.com/mpneuried" | ||
}, | ||
"main": "./index.js", | ||
@@ -23,3 +28,3 @@ "homepage": "https://github.com/tcs-de/nodecache", | ||
"dependencies": { | ||
"lodash": "3.x || 2.x", | ||
"lodash": "4.x", | ||
"clone": "1.0.x" | ||
@@ -31,7 +36,8 @@ }, | ||
"grunt-regarde": "0.1.x", | ||
"grunt-contrib-coffee": "0.13.x", | ||
"grunt-include-replace": "3.0.x", | ||
"grunt-run": "0.3.x", | ||
"grunt-contrib-clean": "0.6.x" | ||
"grunt-contrib-coffee": "1.0.x", | ||
"grunt-include-replace": "3.2.x", | ||
"grunt-run": "0.5.x", | ||
"grunt-contrib-clean": "1.0.x", | ||
"grunt-banner": "0.6.x" | ||
} | ||
} |
@@ -499,5 +499,11 @@ node-cache | ||
## Compatibility | ||
This module should work well until node `0.6.x`. | ||
But it's tested only until version `0.10.x`. | ||
## Release History | ||
|Version|Date|Description| | ||
|:--:|:--:|:--| | ||
|3.2.1|2016-03-21|Updated lodash to 4.x.; optimized grunt | | ||
|3.2.0|2016-01-29|Added method `getTtl` to get the time when a key expires. See [#49](https://github.com/tcs-de/nodecache/issues/49)| | ||
@@ -504,0 +510,0 @@ |3.1.0|2016-01-29|Added option `errorOnMissing` to throw/callback an error o a miss during a `.get( "key" )`. Thanks to [David Godfrey](https://github.com/david-byng) for the pull [#45](https://github.com/tcs-de/nodecache/pull/45). Added docker files and a script to run test on different node versions locally| |
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
35891
9
520
574
8
+ Addedlodash@4.17.21(transitive)
- Removedlodash@3.10.1(transitive)
Updatedlodash@4.x