Kick expirations back on view

This commit is contained in:
John Crepezzi 2011-11-28 01:13:14 -05:00
parent cd9bf18d29
commit 92e0f579ca
5 changed files with 12 additions and 8 deletions

View file

@ -53,7 +53,7 @@ RedisDocumentStore.prototype.set = function(key, data, callback, skipExpire) {
RedisDocumentStore.prototype.setExpiration = function(key) {
if (this.expire) {
RedisDocumentStore.client.expire(key, this.expire, function(err, reply) {
if (err || !reply) {
if (err) {
winston.error('failed to set expiry on key: ' + key);
}
});
@ -61,8 +61,12 @@ RedisDocumentStore.prototype.setExpiration = function(key) {
};
// Get a file from a key
RedisDocumentStore.prototype.get = function(key, callback) {
RedisDocumentStore.prototype.get = function(key, callback, skipExpire) {
var _this = this;
RedisDocumentStore.client.get(key, function(err, reply) {
if (!err && !skipExpire) {
_this.setExpiration(key);
}
callback(err ? false : reply);
});
};