maybe not the most effiecent use of memory.
(keys []string, user TwitterUser)
| 37 | |
| 38 | // maybe not the most effiecent use of memory. |
| 39 | func (c *Cache) SetMultiple(keys []string, user TwitterUser) { |
| 40 | c.mutex.Lock() |
| 41 | defer c.mutex.Unlock() |
| 42 | for _, key := range keys { |
| 43 | c.data[key] = user |
| 44 | go c.expireKeyAfterTTL(key) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func (c *Cache) expireKeyAfterTTL(key string) { |
| 49 | time.Sleep(c.ttl) |
no test coverage detected