Skip to content

Commit 27a2967

Browse files
Initial commit
0 parents  commit 27a2967

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-0
lines changed

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# Compiled binary addons (http://nodejs.org/api/addons.html)
20+
build/Release
21+
22+
# Dependency directory
23+
# Deployed apps should consider commenting this line out:
24+
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
25+
node_modules

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 npmawesome.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# example-hashring
2+
3+
This example refers to the article on [nodejitsu.com](http://blog.nodejitsu.com/) and [npmawesome.com](http://npmawesome.com/posts/hashring) about `hashring`.
4+
5+
## Usage
6+
7+
git clone https://github.com/npmawesome/example-hashring
8+
cd example-hashring
9+
npm install
10+
npm test
11+
12+
## License
13+
14+
MIT

index.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* example-hashring
3+
* http://npmawesome.com/posts/hashring
4+
*
5+
* Copyright(c) 2014 npmawesome.com
6+
*
7+
* MIT Licensed
8+
*/
9+
10+
'use strict';
11+
12+
var HashRing = require('hashring');
13+
14+
var ring = new HashRing({
15+
'127.0.0.1:11211': { vnodes: 50 },
16+
'127.0.0.2:11211': { vnodes: 200 },
17+
'127.0.0.3:11211': { vnodes: 100 }
18+
});
19+
20+
console.log(ring.get('npmawesome'));
21+
console.log(ring.get('http://...'));
22+
console.log(ring.range('http://...', 2));

package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "example-hashring",
3+
"version": "1.0.0",
4+
"description": "Example which describes how to use the hashring module.",
5+
"homepage": "http://npmawesome.com/posts/hashring",
6+
"license": "MIT",
7+
"scripts": {
8+
"test": "node index.js"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/npmawesome/example-hashring"
13+
},
14+
"dependencies": {
15+
"hashring": "^3.0.0"
16+
}
17+
}

0 commit comments

Comments
 (0)