(key KeyType)
| 1 | package cache |
| 2 | |
| 3 | func (c *Cache[KeyType, DataType]) Get(key KeyType) (DataType, bool) { |
| 4 | c.Mutex.RLock() |
| 5 | defer c.Mutex.RUnlock() |
| 6 | item, ok := c.Items[key] |
| 7 | if !ok { |
| 8 | var zero DataType |
| 9 | return zero, false |
| 10 | } |
| 11 | return item.Data, ok |
| 12 | } |
no outgoing calls