MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / Put

Method Put

auth/password_hash_test.go:125–136  ·  view source on GitHub ↗

Put adds a key to the cache. No eviction occurs when memory is over filled or greater than the specified size in the cache. The entire cache is cleared and starts building it again from an empty cache instead.

(key string)

Source from the content-addressed store, hash-verified

123// The entire cache is cleared and starts building it again from
124// an empty cache instead.
125func (c *NoReplKeyCache) Put(key string) {
126 c.lock.Lock()
127 if _, ok := c.cache[key]; ok {
128 c.lock.Unlock()
129 return
130 }
131 if len(c.cache) >= c.size {
132 c.cache = map[string]struct{}{}
133 }
134 c.cache[key] = struct{}{}
135 c.lock.Unlock()
136}
137
138// Len returns the number of keys in the cache.
139func (c *NoReplKeyCache) Len() int {

Callers

nothing calls this directly

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected