mirror of
https://github.com/mailgun/groupcache.git
synced 2024-11-16 14:10:04 +00:00
Update README.md
This commit is contained in:
parent
ef54c5c13a
commit
ece2929696
11
README.md
11
README.md
@ -90,10 +90,17 @@ import (
|
||||
)
|
||||
|
||||
func ExampleUsage() {
|
||||
// Keep track of peers in our cluster and add our instance to the pool `http://192.168.1.1:8080`
|
||||
|
||||
// NOTE: It is important to pass the same peer `http://192.168.1.1:8080` to `NewHTTPPoolOpts`
|
||||
// which is provided to `pool.Set()` so the pool can identify which of the peers is our instance.
|
||||
// The pool will not operate correctly if it can't identify which peer is our instance.
|
||||
|
||||
// Pool keeps track of peers in our cluster and identifies which peer owns a key.
|
||||
pool := groupcache.NewHTTPPoolOpts("http://192.168.1.1:8080", &groupcache.HTTPPoolOptions{})
|
||||
|
||||
// Add more peers to the cluster (Ensure our instance is included)
|
||||
// Add more peers to the cluster You MUST Ensure our instance is included in this list else
|
||||
// determining who owns the key accross the cluster will not be consistent, and the pool won't
|
||||
// be able to determine if our instance owns the key.
|
||||
pool.Set("http://192.168.1.1:8080", "http://192.168.1.2:8080", "http://192.168.1.3:8080")
|
||||
|
||||
server := http.Server{
|
||||
|
Loading…
Reference in New Issue
Block a user