GetMaybe returns the key and true if found, nil and false if not
(key string)
| 147 | |
| 148 | // GetMaybe returns the key and true if found, nil and false if not |
| 149 | func (c *Cache) GetMaybe(key string) (value any, found bool) { |
| 150 | c.mu.Lock() |
| 151 | defer c.mu.Unlock() |
| 152 | entry, found := c.cache[key] |
| 153 | if !found { |
| 154 | return nil, found |
| 155 | } |
| 156 | c.used(entry) |
| 157 | return entry.value, found |
| 158 | } |
| 159 | |
| 160 | // Delete the entry passed in |
| 161 | // |