Skip to content

Commit

Permalink
Optional Redis support 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
freaker2k7 committed Aug 1, 2019
1 parent 6a04ed5 commit 13370f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/file.js
Expand Up @@ -7,7 +7,7 @@ var redis = null;

if (args.redis) {
var REDIS = require('redis');
var redis = REDIS.createClient(args.db_port, args.redis);
redis = REDIS.createClient(args.db_port, args.redis);
redis.on('error', log.error);
} else if (args.s3) {
var AWS = require('aws-sdk');
Expand All @@ -34,8 +34,8 @@ module.exports = {
},
'set': function(file, data, callback) {
if (args.redis) {
return redis.set(file, data, function(err, result) {
return redis.expire(file, args.expiry_seconds);
return redis.set(file, data, function(err) {
return !err && redis.expire(file, args.expiry_seconds);
});
} else if (args.s3) {
return S3.putObject({Bucket: args.s3, Key: file, Body: data}, function(err) {
Expand Down

0 comments on commit 13370f3

Please sign in to comment.