MCPcopy
hub / github.com/lindb/lindb / Cleanup

Method Cleanup

kv/table/cache.go:136–149  ·  view source on GitHub ↗

Cleanup cleans the expired reader from cache.

()

Source from the content-addressed store, hash-verified

134
135// Cleanup cleans the expired reader from cache.
136func (c *storeCache) Cleanup() {
137 c.mutex.Lock()
138 defer c.mutex.Unlock()
139
140 ttl := c.ttl.Milliseconds()
141 c.cache.Walk(func(entry *cacheEntry) bool {
142 if entry.ref.Load() == 0 && timeutil.Now()-entry.last > ttl {
143 c.evict(entry)
144 metrics.TableCacheStatistics.Evict.Incr()
145 return true
146 }
147 return false
148 })
149}
150
151// Close closes reader resource and cleans cache data.
152func (c *storeCache) Close() error {

Callers

nothing calls this directly

Calls 6

evictMethod · 0.95
WalkMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
LoadMethod · 0.65
IncrMethod · 0.45

Tested by

no test coverage detected