Skip to content

Commit c0c37ed

Browse files
committed
make sure delete deletes from expiration cache
1 parent 17de371 commit c0c37ed

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/cache.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Cache.prototype.delete = function(key){
5858
var data = load.call(this);
5959
delete data[key];
6060
store.call(this, data);
61+
if(this.expirationCache){
62+
this.expirationCache.delete(key);
63+
}
6164
}
6265

6366
function load(){
@@ -74,6 +77,10 @@ function store(data){
7477
}
7578

7679
function setExpiration(key, options){
80+
if(!this.expirationCache){
81+
return;
82+
}
83+
7784
var expirationMilli = getExpirationMilliSeconds(options);
7885
var date = new Date();
7986
date.setMilliseconds(date.getMilliseconds() + expirationMilli);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"homepage": "http://github.com/kyleheddon/cache.js",
1111
"main": "index.js",
12-
"version": "0.1.0",
12+
"version": "0.1.1",
1313
"devDependencies": {
1414
"gulp": "~3.8",
1515
"gulp-jasmine": "~2.0",

0 commit comments

Comments
 (0)