getTimestampedEntry returns the TimestampedEntry stored under the given key.
(key string)
| 78 | |
| 79 | // getTimestampedEntry returns the TimestampedEntry stored under the given key. |
| 80 | func (c *ExpirationCache) getTimestampedEntry(key string) (*TimestampedEntry, bool) { |
| 81 | item, _ := c.cacheStorage.Get(key) |
| 82 | if tsEntry, ok := item.(*TimestampedEntry); ok { |
| 83 | return tsEntry, true |
| 84 | } |
| 85 | return nil, false |
| 86 | } |
| 87 | |
| 88 | // getOrExpire retrieves the object from the TimestampedEntry if and only if it hasn't |
| 89 | // already expired. It holds a write lock across deletion. |