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

Function newFastCache

cachebench/cache_bench_test.go:158–171  ·  view source on GitHub ↗
(keysInWindow int)

Source from the content-addressed store, hash-verified

156}
157
158func newFastCache(keysInWindow int) *FastCache {
159 cache := fastcache.New(keysInWindow * maxKeyLength)
160
161 // Enforce full initialization of internal structures. This is taken
162 // from GetPutBenchmark.java from java caffeine. It is required in
163 // caffeine given that it keeps buffering the keys for applying the
164 // necessary changes later. This is probably unnecessary here.
165 for i := 0; i < 2*workloadSize; i++ {
166 cache.Set([]byte(strconv.Itoa(i)), []byte("data"))
167 }
168 cache.Reset()
169
170 return &FastCache{cache}
171}
172
173//========================================================================
174// FreeCache

Callers 1

BenchmarkCachesFunction · 0.85

Calls 2

SetMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected