New returns a new cache with the provided maximum items. A maxEntries of 0 means no limit.
(maxEntries int)
| 41 | // New returns a new cache with the provided maximum items. |
| 42 | // A maxEntries of 0 means no limit. |
| 43 | func New(maxEntries int) *Cache { |
| 44 | return &Cache{ |
| 45 | maxEntries: maxEntries, |
| 46 | ll: list.New(), |
| 47 | cache: make(map[string]*list.Element), |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // NewUnlocked is like New but returns a Cache that is not safe |
| 52 | // for concurrent access. |
no outgoing calls