(key string)
| 19 | } |
| 20 | |
| 21 | func (c *Cache) Get(key string) (TwitterUser, bool) { |
| 22 | c.mutex.RLock() |
| 23 | defer c.mutex.RUnlock() |
| 24 | user, found := c.data[key] |
| 25 | if !found { |
| 26 | return TwitterUser{}, false |
| 27 | } |
| 28 | return user.copy(), true |
| 29 | } |
| 30 | |
| 31 | func (c *Cache) Set(key string, user TwitterUser) { |
| 32 | c.mutex.Lock() |
no test coverage detected