MCPcopy Create free account
hub / github.com/AdRoll/baker / Store

Method Store

filter/metadata/cache.go:22–34  ·  view source on GitHub ↗

Store caches key and value in the cache.

(key, value interface{})

Source from the content-addressed store, hash-verified

20
21// Store caches key and value in the cache.
22func (c *Cache) Store(key, value interface{}) {
23 c.mx.Lock()
24
25 if c.nentries == maxCacheEntries {
26 c.nentries -= c.clear()
27 }
28
29 if _, loaded := c.cache.LoadOrStore(key, value); !loaded {
30 c.nentries++
31 }
32
33 c.mx.Unlock()
34}
35
36// Load loads from the cache the value that is mapped to key, or bool if
37// the cache doesn't contain key.

Callers 5

TestCacheFunction · 0.95
StartMethod · 0.80
uploadDirectoryMethod · 0.80
ProcessMethod · 0.80
setFatalErrMethod · 0.80

Calls 1

clearMethod · 0.95

Tested by 1

TestCacheFunction · 0.76