{"_id":"multi-redis","_rev":"38-a6f20f9227ab19aaa9da5a1f69670f51","name":"multi-redis","description":"Use a hashring to manage distributing load to multiple redis clients","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"multi-redis","description":"Use a hashring to manage distributing load to multiple redis clients","version":"0.1.0","author":{"name":"Jarrett Cruger","email":"jcrugzz@gmail.com"},"repository":{"url":"git://github.com/jcrugzz/multi-redis.git"},"main":"index.js","scripts":{"test":"tape test/*.js"},"engines":{"node":"0.10.x"},"dependencies":{"redis":"~0.8.4","hashring":"~1.0.1"},"devDependencies":{"tape":"~1.0.2"},"license":"MIT","bugs":{"url":"https://github.com/jcrugzz/multi-redis/issues"},"_id":"multi-redis@0.1.0","dist":{"shasum":"40d4367e78db41673011bbe8643ca1b0412fcc0c","tarball":"https://registry.npmjs.org/multi-redis/-/multi-redis-0.1.0.tgz","integrity":"sha512-xRijepizL48Hoh7e9MMZ7NzzqgwD1+RowbRKPccMRL2LrQGgkUtfj0JLVYREtqrcDN0rV9GUDSrDm12Awy5bog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwl5EhQgdrf9bbA4tzWWArF1s3hOr0Ovjf3NN3Td41CAIgIzRFzEo4iiSPwq0OP7aqAL48PlHgywNQlIM8JkhIcZg="}]},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"jcrugzz","email":"jcrugzz@gmail.com"},"maintainers":[{"name":"jcrugzz","email":"jcrugzz@gmail.com"}]},"0.1.1":{"name":"multi-redis","description":"Use a hashring to manage distributing load to multiple redis clients","version":"0.1.1","author":{"name":"Jarrett Cruger","email":"jcrugzz@gmail.com"},"repository":{"url":"git://github.com/jcrugzz/multi-redis.git"},"main":"index.js","scripts":{"test":"tape test/*.js"},"engines":{"node":"0.10.x || 0.8.x"},"dependencies":{"redis":"~0.8.4","hashring":"~1.0.1"},"devDependencies":{"tape":"~1.0.2"},"license":"MIT","bugs":{"url":"https://github.com/jcrugzz/multi-redis/issues"},"_id":"multi-redis@0.1.1","dist":{"shasum":"7227ed6973a4e681e69d5cc6c48a11db1591a918","tarball":"https://registry.npmjs.org/multi-redis/-/multi-redis-0.1.1.tgz","integrity":"sha512-flsBaSv/hYKU8tifh6N6klPVpnobn2P5bR3yidyxPh7zDBN4EvLNH/X4/22R0uM1HGP9c5UhK3Q+cVhkAR5vZg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmbNZt0R4J63/WcQbICsJ48TK4jk4jIgX+6iVIqRMYzQIhAN/u2xNksbZrnm/XbAKiQyvcQfrZ3eyo3pn3zO9r+4lG"}]},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"jcrugzz","email":"jcrugzz@gmail.com"},"maintainers":[{"name":"jcrugzz","email":"jcrugzz@gmail.com"}]}},"readme":"# multi-redis\n\n[![build status](https://secure.travis-ci.org/jcrugzz/multi-redis.png)](http://travis-ci.org/jcrugzz/multi-redis)\n\n[![NPM](https://nodei.co/npm/multi-redis.png)](https://nodei.co/npm/multi-redis/)\n\nA simple wrapper around the [`node_redis`][redis] and [`node-hashring`][hashring]\nmodules to allow for an easy way to use consistent hashing to distribute to\nmultiple redises.\n\n## Example\n```js\n//\n// Pass in array of redis objects of the form...\n// [\n//   {\n//     \"host\": \"127.0.0.1\",\n//     \"port\": 6379\n//   }\n// ]\n// into this function\n//\nvar multiRedis = require('../')();\nvar key = 'jcrugzz/test';\n//\n// Return a redis client based on the consistent hasing of hashring\n//\nvar client = multiRedis.client(key);\n\n//\n// Now we have a standard `node_redis` client\n//\nclient.set(key, 'O hai there', function (err) {\n  if (err) {\n    process.exit(1);\n    return console.error(err)\n  }\n  console.log('SUCCESS');\n\n  client.get(key, function (err, res) {\n    if (err) {\n      process.exit(1);\n      return console.error(err)\n    }\n    console.log(res);\n    process.exit(0);\n  });\n});\n```\n\n## API\n\n### Constructor -> `var multiRedis = require('multi-redis')(redises)`\n\nInstantiates a multiRedis instance that sets up the array of redis clients\n\n### `var client = multRedis.client(key)`\n\nRetrieves the correct client based on key given using the consistent hashing of\n[`node-hashring`][hashring]\n\n### `multiRedis.end()`\n\nCalls `redis.end()` for all of the underlying redis clients instantiated by the\nconstructor\n\n### `multiRedis.on('error', function (err) { /* Handle me however you please */ })`\n\nThis is how you handle the errors that are emitted from the underlying\n[`redis`][redis]. Useful for logging purposes as the [`node_redis`][redis]\nlibrary handles reconnections for you but stil emits `ECONNREFUSED` errors when\nthe server is not reachable.\n\n## License\n\nMIT\n\n[redis]: https://github.com/mranney/node_redis\n[hashring]: https://github.com/3rd-Eden/node-hashring\n","maintainers":[{"name":"jcrugzz","email":"jcrugzz@gmail.com"}],"time":{"modified":"2022-06-20T13:25:13.563Z","created":"2013-08-24T05:05:09.793Z","0.1.0":"2013-08-24T05:05:11.060Z","0.1.1":"2013-08-24T05:42:26.118Z"},"author":{"name":"Jarrett Cruger","email":"jcrugzz@gmail.com"},"repository":{"url":"git://github.com/jcrugzz/multi-redis.git"},"readmeFilename":"README.md","users":{"jcrugzz":true}}