MCPcopy
hub / github.com/kubernetes/client-go / Add

Method Add

tools/cache/expiration_cache.go:149–159  ·  view source on GitHub ↗

Add timestamps an item and inserts it into the cache, overwriting entries that might exist under the same key.

(obj interface{})

Source from the content-addressed store, hash-verified

147// Add timestamps an item and inserts it into the cache, overwriting entries
148// that might exist under the same key.
149func (c *ExpirationCache) Add(obj interface{}) error {
150 key, err := c.keyFunc(obj)
151 if err != nil {
152 return KeyError{obj, err}
153 }
154 c.expirationLock.Lock()
155 defer c.expirationLock.Unlock()
156
157 c.cacheStorage.Add(key, &TimestampedEntry{obj, c.clock.Now()})
158 return nil
159}
160
161// Update has not been implemented yet for lack of a use case, so this method
162// simply calls `Add`. This effectively refreshes the timestamp.

Callers 1

UpdateMethod · 0.95

Calls 2

AddMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected