Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatelei/redishashshard
Redis shard implement in JS.
https://github.com/fatelei/redishashshard
Last synced: about 1 month ago
JSON representation
Redis shard implement in JS.
- Host: GitHub
- URL: https://github.com/fatelei/redishashshard
- Owner: fatelei
- Created: 2014-12-10T09:53:24.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-09T15:07:20.000Z (about 9 years ago)
- Last Synced: 2024-11-07T14:04:52.277Z (about 2 months ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Redis Hash Shard
================Redis hash shard implement in JS, using consistent hashing algorithm.
![Build Status](https://api.travis-ci.org/fatelei/RedisHashShard.svg)
# Install
```
npm install redis-hash-shard
```# APIs
## RedisHashShard
Initialize a new `RedisHashShard` instance.
+ servers {Array}: Redis server connection string or object, it must include `name` in object or string
+ hashMethod {String}: Which hash method to be used, `md5` or `crc32`, default is `crc32`### Usage
```
const servers = [
{
host: 'localhost',
port: 6379,
db: 0,
auth: 'xxx',
passwd: 'xxx',
name: 'test'
}
];const shard = new RedisHashShard(servers);
```Or
```
const servers = [
'redis://xx:xx@localhost/0?name=test'
];const shard = new RedisHashShard(servers);
```## Redis command
Currently support commands:
+ get
+ set# TODO
+ Support more redis commands.