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)
| 180 | // before attempting the replace operation. The replace operation will |
| 181 | // delete the contents of the ExpirationCache `c`. |
| 182 | func (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 |
| 199 | func (c *ExpirationCache) Resync() error { |