Skip to content

Commit

Permalink
fix: the redis cache need update and set ttl on touching a key
Browse files Browse the repository at this point in the history
  • Loading branch information
demetriusj committed Apr 9, 2015
1 parent d05e684 commit a749bc9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cache-layer/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ redisCacheLayer.prototype.get = function(key, cb) {

redisCacheLayer.prototype.touch = function(key, data, cb) {
if(this.expire !== null) {
this.client.expire(key, this.expire);
var _this = this;
this.set(key, data, function(err) {
if(err) {
return cb(err);
}

_this.client.expire(key, _this.expire, cb);
});
} else {
this.set(key, data, cb);
}
Expand Down

0 comments on commit a749bc9

Please sign in to comment.