New constructs a Store with the supplied max size and TTL.
(maxSize int, ttl time.Duration)
| 27 | |
| 28 | // New constructs a Store with the supplied max size and TTL. |
| 29 | func New(maxSize int, ttl time.Duration) *Store { |
| 30 | if maxSize <= 0 { |
| 31 | maxSize = 1024 |
| 32 | } |
| 33 | return &Store{ |
| 34 | maxSize: maxSize, |
| 35 | ttl: ttl, |
| 36 | items: make(map[string]*list.Element, maxSize), |
| 37 | lru: list.New(), |
| 38 | now: time.Now, |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // Get returns the cached value and true if present and unexpired. |
| 43 | func (s *Store) Get(key string) (any, bool) { |
nothing calls this directly
no outgoing calls
no test coverage detected