Skip to content

Commit

Permalink
added example on how to use getNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Werner committed Feb 21, 2017
1 parent 8d1c83b commit e409416
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ ring := hashring.New(memcacheServers)
server, _ := ring.GetNode("my_key")
```

To fulfill replication requirements, you can also get a list of servers that should store your key.
```go
serversInRing := []string{"192.168.0.246:11212",
"192.168.0.247:11212",
"192.168.0.248:11212",
"192.168.0.249:11212",
"192.168.0.250:11212",
"192.168.0.251:11212",
"192.168.0.252:11212"}

replicaCount := 3
ring := hashring.New(serversInRing)
server, _ := ring.GetNodes("my_key", replicaCount)
```

Using weights example ::

```go
Expand Down

0 comments on commit e409416

Please sign in to comment.