overleaf/libraries/redis-wrapper/index.coffee

20 lines
477 B
CoffeeScript
Raw Normal View History

_ = require("underscore")
2014-09-25 12:33:27 -04:00
module.exports =
createClient: (opts)->
if opts.endpoints?
standardOpts = _.clone(opts)
delete standardOpts.endpoints
delete standardOpts.masterName
client = require("redis-sentinel").createClient opts.endpoints, opts.masterName, standardOpts
2014-09-25 12:33:27 -04:00
else
standardOpts = _.clone(opts)
delete standardOpts.port
delete standardOpts.host
client = require("redis").createClient opts.port, opts.host, standardOpts
2014-09-25 12:33:27 -04:00
return client