Get looks up a key's value from the cache.
(key Key)
| 71 | |
| 72 | // Get looks up a key's value from the cache. |
| 73 | func (c *Cache) Get(key Key) (value []byte, ok bool) { |
| 74 | c.RLock() |
| 75 | |
| 76 | if c.cache == nil { |
| 77 | c.RUnlock() |
| 78 | return |
| 79 | } |
| 80 | |
| 81 | if ele, hit := c.cache[key]; hit { |
| 82 | c.ll.MoveToFront(ele) |
| 83 | c.RUnlock() |
| 84 | return ele.Value.(*entry).value, true |
| 85 | } |
| 86 | |
| 87 | c.RUnlock() |
| 88 | return |
| 89 | } |
| 90 | |
| 91 | // Remove removes the provided key from the cache. |
| 92 | func (c *Cache) Remove(key Key) { |
no outgoing calls
no test coverage detected