ReadRaw attempts to retrieve a cached value as an interface{}, if the value does not exists returns nil and false.
(h Hashable)
| 88 | // ReadRaw attempts to retrieve a cached value as an interface{}, if the value |
| 89 | // does not exists returns nil and false. |
| 90 | func (c *Cache) ReadRaw(h Hashable) (interface{}, bool) { |
| 91 | c.mu.RLock() |
| 92 | defer c.mu.RUnlock() |
| 93 | |
| 94 | item, ok := c.items[h.Hash()] |
| 95 | if ok { |
| 96 | return item.Value.(*cacheItem).value, true |
| 97 | } |
| 98 | |
| 99 | return nil, false |
| 100 | } |
| 101 | |
| 102 | // Write stores a value in memory. If the value already exists its overwritten. |
| 103 | func (c *Cache) Write(h Hashable, value interface{}) { |
no test coverage detected