Comparing version 0.0.2 to 0.0.3
12
index.js
@@ -91,10 +91,8 @@ var events = require("events"); | ||
var item = cache[key]; | ||
if (!item) return null; | ||
_length --; | ||
if (item) { | ||
if (!config.timeoutDisabled) removeExpiration(item); | ||
delete cache[key]; | ||
return item.value; | ||
} | ||
return null; | ||
if (!config.timeoutDisabled) removeExpiration(item); | ||
delete cache[key]; | ||
return item.value; | ||
}; | ||
@@ -101,0 +99,0 @@ |
{ | ||
"name": "mem-cache", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "simple in memory key/value cache with autoclean by timeout", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,2 +47,5 @@ # node-mem-cache | ||
#### keys | ||
*Returns an string array containing all items' keys. It will include keys of items that are expired but weren't been removed yet. | ||
#### length | ||
@@ -54,2 +57,2 @@ * Property that returns the current number of entries in the cache | ||
#### expired | ||
* This event will be emitted for every cache entry that was removed because timeout | ||
* This event will be emitted for every cache entry that was removed because timed out |
16004
56
367