diff --git a/groupcache.go b/groupcache.go index 75812b5..ecc66e9 100644 --- a/groupcache.go +++ b/groupcache.go @@ -28,6 +28,7 @@ import ( "context" "errors" "strconv" + "strings" "sync" "sync/atomic" "time" @@ -297,6 +298,16 @@ func (g *Group) Set(ctx context.Context, key string, value []byte, expire time.T func (g *Group) Remove(ctx context.Context, key string) error { g.peersOnce.Do(g.initPeers) + var peerList []string + for _, peer := range g.peers.GetAll() { + peerList = append(peerList, peer.GetURL()) + } + logrus.WithFields(logrus.Fields{ + "name": g.name, + "peers": strings.Join(peerList, ","), + "key": key, + }).Info("Group.Remove()") + _, err := g.removeGroup.Do(key, func() (interface{}, error) { // Remove from key owner first owner, ok := g.peers.PickPeer(key)