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

Method Replace

tools/cache/expiration_cache.go:182–196  ·  view source on GitHub ↗

Replace will convert all items in the given list to TimestampedEntries before attempting the replace operation. The replace operation will delete the contents of the ExpirationCache `c`.

(list []interface{}, resourceVersion string)

Source from the content-addressed store, hash-verified

180// before attempting the replace operation. The replace operation will
181// delete the contents of the ExpirationCache `c`.
182func (c *ExpirationCache) Replace(list []interface{}, resourceVersion string) error {
183 items := make(map[string]interface{}, len(list))
184 ts := c.clock.Now()
185 for _, item := range list {
186 key, err := c.keyFunc(item)
187 if err != nil {
188 return KeyError{item, err}
189 }
190 items[key] = &TimestampedEntry{item, ts}
191 }
192 c.expirationLock.Lock()
193 defer c.expirationLock.Unlock()
194 c.cacheStorage.Replace(items, resourceVersion)
195 return nil
196}
197
198// Resync will touch all objects to put them into the processing queue
199func (c *ExpirationCache) Resync() error {

Callers

nothing calls this directly

Calls 2

NowMethod · 0.65
ReplaceMethod · 0.65

Tested by

no test coverage detected