Update README.md

This commit is contained in:
Derrick J. Wippler 2022-01-07 10:51:44 -06:00 committed by GitHub
parent ef54c5c13a
commit ece2929696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{