GetByKey returns the request item, or exists=false. GetByKey is completely threadsafe as long as you treat all items as immutable.
(key string)
| 202 | // GetByKey returns the request item, or exists=false. |
| 203 | // GetByKey is completely threadsafe as long as you treat all items as immutable. |
| 204 | func (c *cache) GetByKey(key string) (item interface{}, exists bool, err error) { |
| 205 | item, exists = c.cacheStorage.Get(key) |
| 206 | return item, exists, nil |
| 207 | } |
| 208 | |
| 209 | // Replace will delete the contents of 'c', using instead the given list. |
| 210 | // 'c' takes ownership of the list, you should not reference the list again |