index.coffee 477 B

12345678910111213141516171819
  1. _ = require("underscore")
  2. module.exports =
  3. createClient: (opts)->
  4. if opts.endpoints?
  5. standardOpts = _.clone(opts)
  6. delete standardOpts.endpoints
  7. delete standardOpts.masterName
  8. client = require("redis-sentinel").createClient opts.endpoints, opts.masterName, standardOpts
  9. else
  10. standardOpts = _.clone(opts)
  11. delete standardOpts.port
  12. delete standardOpts.host
  13. client = require("redis").createClient opts.port, opts.host, standardOpts
  14. return client