MCPcopy Create free account
hub / github.com/TalkingData/owl / DeleteExpired

Method DeleteExpired

controller/cache/cache.go:181–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179}
180
181func (c *cache) DeleteExpired() {
182 var evictedItems []kv
183 timeNow := time.Now().UnixNano()
184 c.mu.Lock()
185 for k, v := range c.items {
186 if v.Expiration > 0 && v.Expiration < timeNow {
187 v, evicted := c.delete(k)
188 if evicted {
189 evictedItems = append(evictedItems, kv{k, v})
190 }
191 }
192 }
193 c.mu.Unlock()
194 for _, v := range evictedItems {
195 c.onEvicted(v.key, v.value)
196 }
197}
198
199func (c *cache) Item() map[string]Item {
200 c.mu.Lock()

Callers 1

RunMethod · 0.80

Calls 1

deleteMethod · 0.95

Tested by

no test coverage detected