MCPcopy Create free account
hub / github.com/dgraph-io/dgraph-benchmarks / Get

Method Get

cachebench/cache_bench_test.go:215–227  ·  view source on GitHub ↗
(key []byte)

Source from the content-addressed store, hash-verified

213}
214
215func (g *GroupCache) Get(key []byte) ([]byte, error) {
216 hashVal := xxhash.Sum64(key)
217 shardNum := hashVal & segmentAndOpVal
218
219 g.locks[shardNum].Lock()
220 v, ok := g.shards[shardNum].Get(string(key))
221 g.locks[shardNum].Unlock()
222
223 if ok {
224 return v.([]byte), nil
225 }
226 return nil, errKeyNotFound
227}
228
229func (g *GroupCache) Set(key, value []byte) error {
230 hashVal := xxhash.Sum64(key)

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected