Contains checks if a key is in the cache, without updating the recent-ness or deleting it for being stale.
(key K)
| 162 | // Contains checks if a key is in the cache, without updating the recent-ness |
| 163 | // or deleting it for being stale. |
| 164 | func (c *LRU[K, V]) Contains(key K) (ok bool) { |
| 165 | c.mu.RLock() |
| 166 | defer c.mu.RUnlock() |
| 167 | _, ok = c.items[key] |
| 168 | return ok |
| 169 | } |
| 170 | |
| 171 | // Peek returns the key value (or undefined if not found) without updating |
| 172 | // the "recently used"-ness of the key. |
no outgoing calls