MCPcopy
hub / github.com/coocood/freecache / Get

Method Get

cache.go:80–87  ·  view source on GitHub ↗

Get returns the value or not found error.

(key []byte)

Source from the content-addressed store, hash-verified

78
79// Get returns the value or not found error.
80func (cache *Cache) Get(key []byte) (value []byte, err error) {
81 hashVal := hashFunc(key)
82 segID := hashVal & segmentAndOpVal
83 cache.locks[segID].Lock()
84 value, _, err = cache.segments[segID].get(key, nil, hashVal, false)
85 cache.locks[segID].Unlock()
86 return
87}
88
89// MultiGet returns values and errors for the given keys. The returned slices
90// have the same length as keys; values[i] and errs[i] correspond to keys[i].

Callers 13

GetIntMethod · 0.95
TestFreeCacheFunction · 0.95
TestOverwriteFunction · 0.95
TestGetOrSetFunction · 0.95
TestPeekWithExpirationFunction · 0.95
TestExpireFunction · 0.95
TestLargeEntryFunction · 0.95
TestEvacuateCountFunction · 0.95
BenchmarkCacheGetFunction · 0.95
TestUpdateFunction · 0.95

Calls 2

hashFuncFunction · 0.85
getMethod · 0.80

Tested by 11

TestFreeCacheFunction · 0.76
TestOverwriteFunction · 0.76
TestGetOrSetFunction · 0.76
TestPeekWithExpirationFunction · 0.76
TestExpireFunction · 0.76
TestLargeEntryFunction · 0.76
TestEvacuateCountFunction · 0.76
BenchmarkCacheGetFunction · 0.76
TestUpdateFunction · 0.76