node-cache
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -203,3 +203,3 @@ var EventEmitter, NodeCache, _, | ||
NodeCache.prototype._check = function(key, data) { | ||
if (data.t < Date.now() && data.t !== 0) { | ||
if (data.t !== 0 && data.t < Date.now()) { | ||
this.del(key); | ||
@@ -253,4 +253,8 @@ this.emit("expired", key, this._unwrap(data)); | ||
return this.options.arrayValueSize * value.length; | ||
} else if (_.isNumber(value)) { | ||
return 8; | ||
} else if (_.isObject(value)) { | ||
return this.options.objectValueSize * _.size(value); | ||
} else { | ||
return this.options.objectValueSize * _.size(value); | ||
return 0; | ||
} | ||
@@ -257,0 +261,0 @@ }; |
@@ -6,3 +6,3 @@ { | ||
"tags": [ "cache", "caching", "local", "variable", "multi", "memory", "internal", "node", "memcached", "object" ], | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": "tcs-de <github@tcs.de>", | ||
@@ -9,0 +9,0 @@ "main": "./index.js", |
@@ -307,2 +307,3 @@ node-cache | ||
|:--:|:--:|:--| | ||
|v1.0.3|2014-11-07|fix for setting numeric values. Thanks to [kaspars](https://github.com/kaspars) + optimized key ckeck.| | ||
|v1.0.2|2014-09-17|Small change for better ttl handling| | ||
@@ -309,0 +310,0 @@ |v1.0.1|2014-05-22|Readme typos. Thanks to [mjschranz](https://github.com/mjschranz)| |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -361,7 +361,7 @@ var VCache, ks, localCache, localCacheTTL, randomString, vs, _, | ||
val = randomString(20); | ||
key = randomString(7); | ||
key2 = randomString(7); | ||
key3 = randomString(7); | ||
key4 = randomString(7); | ||
key5 = randomString(7); | ||
key = "k1_" + randomString(7); | ||
key2 = "k2_" + randomString(7); | ||
key3 = "k3_" + randomString(7); | ||
key4 = "k4_" + randomString(7); | ||
key5 = "k5_" + randomString(7); | ||
_keys = [key, key2, key3, key4, key5]; | ||
@@ -421,15 +421,18 @@ n = 0; | ||
return process.nextTick(function() { | ||
var startKeys, _testExpired, _testSet, | ||
_this = this; | ||
var startKeys, _testExpired, _testSet; | ||
startKeys = localCache.getStats().keys; | ||
key = "autotest"; | ||
_testExpired = function(_key, _val) { | ||
if (__indexOf.call(_keys, _key) < 0) { | ||
_testExpired = (function(_this) { | ||
return function(_key, _val) { | ||
if (__indexOf.call(_keys, _key) < 0) { | ||
assert.equal(_key, key); | ||
assert.equal(_val, val); | ||
} | ||
}; | ||
})(this); | ||
_testSet = (function(_this) { | ||
return function(_key) { | ||
assert.equal(_key, key); | ||
assert.equal(_val, val); | ||
} | ||
}; | ||
_testSet = function(_key) { | ||
assert.equal(_key, key); | ||
}; | ||
}; | ||
})(this); | ||
localCache.once("set", _testSet); | ||
@@ -436,0 +439,0 @@ return localCache.set(key, val, 0.5, function(err, res) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
341
58538
10
788