Delete removes an item from the cache.
(obj interface{})
| 166 | |
| 167 | // Delete removes an item from the cache. |
| 168 | func (c *ExpirationCache) Delete(obj interface{}) error { |
| 169 | key, err := c.keyFunc(obj) |
| 170 | if err != nil { |
| 171 | return KeyError{obj, err} |
| 172 | } |
| 173 | c.expirationLock.Lock() |
| 174 | defer c.expirationLock.Unlock() |
| 175 | c.cacheStorage.Delete(key) |
| 176 | return nil |
| 177 | } |
| 178 | |
| 179 | // Replace will convert all items in the given list to TimestampedEntries |
| 180 | // before attempting the replace operation. The replace operation will |