func()

in groupcache.go [434:452]


func (g *Group) Contain(ctx Context, key string) (bool, error) {
	g.peersOnce.Do(g.initPeers)
	g.Stats.Contains.Add(1)

	if _, cacheHit := g.lookupCache(key); cacheHit {
		g.Stats.CacheHits.Add(1)
		return true, nil
	}

	// Optimization to avoid double unmarshalling or copying: keep
	// track of whether the dest was already populated. One caller
	// (if local) will set this; the losers will not. The common
	// case will likely be one caller.
	ok, _, err := g.check(ctx, key)
	if err != nil {
		return true, err
	}
	return ok, nil
}