MCPcopy Index your code
hub / github.com/containers/nydus-storage-plugin / decreaseOnceFunc

Method decreaseOnceFunc

pkg/cache/lrucache.go:82–89  ·  view source on GitHub ↗
(rc *refCounter)

Source from the content-addressed store, hash-verified

80}
81
82func (c *LRUCache) decreaseOnceFunc(rc *refCounter) func() {
83 var once sync.Once
84 return func() {
85 c.mu.Lock()
86 defer c.mu.Unlock()
87 once.Do(func() { rc.dec() })
88 }
89}
90
91type refCounter struct {
92 onEvicted func(key string, value interface{})

Callers 2

GetMethod · 0.95
AddMethod · 0.95

Calls 1

decMethod · 0.80

Tested by

no test coverage detected