NewCache initializes and returns a new Cache with the given capacity
(capacity int)
| 28 | |
| 29 | // NewCache initializes and returns a new Cache with the given capacity |
| 30 | func NewCache(capacity int) *Cache { |
| 31 | return &Cache{ |
| 32 | items: make(map[string]*list.Element), |
| 33 | eviction: list.New(), |
| 34 | capacity: capacity, |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // Set adds or updates a cache entry with the specified key, value, and TTL |
| 39 | func (c *Cache) Set(key, value string, ttl time.Duration) { |
no outgoing calls