Skip to content

Commit

Permalink
match callback style
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Feb 24, 2016
1 parent 08f3f02 commit 5946b45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
15 changes: 1 addition & 14 deletions actions/randomNumber.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions initializers/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,23 +205,23 @@ module.exports = {
});
};

api.cache.push = function(key, item, callback){
api.cache.push = function(key, item, next){
var object = JSON.stringify({data: item});
api.redis.client.rpush(api.cache.redisPrefix + key, object, function(err){
if(typeof next === 'function'){ process.nextTick(function(){ next(err); }); }
});
};

api.cache.pop = function(key, callback){
api.cache.pop = function(key, next){
api.redis.client.lpop(api.cache.redisPrefix + key, function(err, object){
if(err){ return callback(err); }
if(err){ return next(err); }
var item = JSON.parse(object);
return callback(null, item.data);
return next(null, item.data);
});
};

api.cache.listLength = function(key, callback){
api.redis.client.llen(api.cache.redisPrefix + key, callback);
api.cache.listLength = function(key, next){
api.redis.client.llen(api.cache.redisPrefix + key, next);
};

api.cache.lock = function(key, expireTimeMS, next){
Expand Down

0 comments on commit 5946b45

Please sign in to comment.