NewCache initializes a new caching space with default settings.
()
| 60 | |
| 61 | // NewCache initializes a new caching space with default settings. |
| 62 | func NewCache() *Cache { |
| 63 | c, err := NewCacheWithCapacity(defaultCapacity) |
| 64 | |
| 65 | if err != nil { |
| 66 | panic(err.Error()) // Should never happen as we're not providing a negative defaultCapacity. |
| 67 | } |
| 68 | |
| 69 | return c |
| 70 | } |
| 71 | |
| 72 | func (c *Cache) init() { |
| 73 | c.items = make(map[uint64]*list.Element) |