MCPcopy
hub / github.com/lindb/lindb / Walk

Method Walk

kv/table/cache.go:242–256  ·  view source on GitHub ↗

Walk walks the old entries, if it's expired, need to remove.

(fn func(entry *cacheEntry) bool)

Source from the content-addressed store, hash-verified

240
241// Walk walks the old entries, if it's expired, need to remove.
242func (c *LRUCache) Walk(fn func(entry *cacheEntry) bool) {
243 size := len(c.items)
244 for i := 0; i < size; i++ {
245 // get oldest entry
246 ent := c.evictList.Back()
247 if ent != nil {
248 entry := ent.Value.(*cacheEntry)
249 if fn(entry) {
250 c.removeElement(ent)
251 } else {
252 break
253 }
254 }
255 }
256}
257
258// Purge is used to completely clear the cache.
259func (c *LRUCache) Purge(fn func(entry *cacheEntry)) {

Callers 2

CleanupMethod · 0.80
ParseFunction · 0.80

Calls 1

removeElementMethod · 0.95

Tested by

no test coverage detected