MCPcopy Create free account
hub / github.com/antchfx/xpath / NewLoadingCache

Function NewLoadingCache

cache.go:32–37  ·  view source on GitHub ↗

NewLoadingCache creates a new instance of a loading cache with capacity. Capacity must be >= 0, or it will panic. Capacity == 0 means the cache growth is unbounded.

(load loadFunc, capacity int)

Source from the content-addressed store, hash-verified

30// NewLoadingCache creates a new instance of a loading cache with capacity. Capacity must be >= 0, or
31// it will panic. Capacity == 0 means the cache growth is unbounded.
32func NewLoadingCache(load loadFunc, capacity int) *loadingCache {
33 if capacity < 0 {
34 panic("capacity must be >= 0")
35 }
36 return &loadingCache{cap: capacity, load: load, m: make(map[interface{}]interface{})}
37}
38
39func (c *loadingCache) get(key interface{}) (interface{}, error) {
40 c.RLock()

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…