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

Method Peek

cache.go:211–218  ·  view source on GitHub ↗

Peek returns the value or not found error, without updating access time or counters. Warning: No expiry check is performed so if an expired value is found, it will be returned without error

(key []byte)

Source from the content-addressed store, hash-verified

209// Warning: No expiry check is performed so if an expired value is found, it will be
210// returned without error
211func (cache *Cache) Peek(key []byte) (value []byte, err error) {
212 hashVal := hashFunc(key)
213 segID := hashVal & segmentAndOpVal
214 cache.locks[segID].Lock()
215 value, _, err = cache.segments[segID].get(key, nil, hashVal, true)
216 cache.locks[segID].Unlock()
217 return
218}
219
220// PeekWithExpiration returns the value and expiration time, without updating access time or counters.
221// Warning: No expiry check is performed so if an expired value is found, it will be

Callers

nothing calls this directly

Calls 2

hashFuncFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected