MCPcopy Index your code
hub / github.com/golang/groupcache / testSetup

Function testSetup

groupcache_test.go:61–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59)
60
61func testSetup() {
62 stringGroup = NewGroup(stringGroupName, cacheSize, GetterFunc(func(_ context.Context, key string, dest Sink) error {
63 if key == fromChan {
64 key = <-stringc
65 }
66 cacheFills.Add(1)
67 return dest.SetString("ECHO:" + key)
68 }))
69
70 protoGroup = NewGroup(protoGroupName, cacheSize, GetterFunc(func(_ context.Context, key string, dest Sink) error {
71 if key == fromChan {
72 key = <-stringc
73 }
74 cacheFills.Add(1)
75 return dest.SetProto(&testpb.TestMessage{
76 Name: proto.String("ECHO:" + key),
77 City: proto.String("SOME-CITY"),
78 })
79 }))
80}
81
82// TestGetDupSuppressString tests that a Getter's Get method is only called once with two
83// outstanding callers. This is the string variant.

Callers

nothing calls this directly

Calls 6

NewGroupFunction · 0.85
GetterFuncFuncType · 0.85
SetStringMethod · 0.65
SetProtoMethod · 0.65
AddMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…