MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Remove

Method Remove

internal/caches/list_memory.go:201–222  ·  view source on GitHub ↗
(hash string)

Source from the content-addressed store, hash-verified

199}
200
201func (this *MemoryList) Remove(hash string) error {
202 this.locker.Lock()
203
204 itemMap, ok := this.itemMaps[this.prefix(hash)]
205 if !ok {
206 this.locker.Unlock()
207 return nil
208 }
209
210 item, ok := itemMap[hash]
211 if ok {
212 if this.onRemove != nil {
213 this.onRemove(item)
214 }
215
216 atomic.AddInt64(&this.count, -1)
217 delete(itemMap, hash)
218 }
219
220 this.locker.Unlock()
221 return nil
222}
223
224// Purge 清理过期的缓存
225// count 每次遍历的最大数量,控制此数字可以保证每次清理的时候不用花太多时间

Callers

nothing calls this directly

Calls 3

prefixMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected