MCPcopy
hub / github.com/caddyserver/caddy / References

Method References

usagepool.go:201–212  ·  view source on GitHub ↗

References returns the number of references (count of usages) to a key in the pool, and true if the key exists, or false otherwise.

(key any)

Source from the content-addressed store, hash-verified

199// References returns the number of references (count of usages) to a
200// key in the pool, and true if the key exists, or false otherwise.
201func (up *UsagePool) References(key any) (int, bool) {
202 up.RLock()
203 upv, loaded := up.pool[key]
204 up.RUnlock()
205 if loaded {
206 // I wonder if it'd be safer to read this value during
207 // our lock on the UsagePool... guess we'll see...
208 refs := upv.refs.Load()
209 return int(refs), true
210 }
211 return 0, false
212}
213
214// Constructor is a function that returns a new value
215// that can destruct itself when it is no longer needed.

Callers 4

ListenerUsageFunction · 0.80
reuseUnixSocketFunction · 0.80

Calls 1

LoadMethod · 0.80

Tested by 2