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

Method del

segment.go:309–319  ·  view source on GitHub ↗
(key []byte, hashVal uint64)

Source from the content-addressed store, hash-verified

307}
308
309func (seg *segment) del(key []byte, hashVal uint64) (affected bool) {
310 slotId := uint8(hashVal >> 8)
311 hash16 := uint16(hashVal >> 16)
312 slot := seg.getSlot(slotId)
313 idx, match := seg.lookup(slot, hash16, key)
314 if !match {
315 return false
316 }
317 seg.delEntryPtr(slotId, slot, idx)
318 return true
319}
320
321func (seg *segment) ttl(key []byte, hashVal uint64) (timeLeft uint32, err error) {
322 slotId := uint8(hashVal >> 8)

Callers 1

DelMethod · 0.80

Calls 3

getSlotMethod · 0.95
lookupMethod · 0.95
delEntryPtrMethod · 0.95

Tested by

no test coverage detected