Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
thrawn01 authored Jan 7, 2022
1 parent ef54c5c commit ece2929
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit ece2929

Please sign in to comment.