New creates a new cache with the default expire duration and interval
()
| 21 | |
| 22 | // New creates a new cache with the default expire duration and interval |
| 23 | func New() *Cache { |
| 24 | return &Cache{ |
| 25 | cache: map[string]*cacheEntry{}, |
| 26 | expireRunning: false, |
| 27 | expireDuration: 300 * time.Second, |
| 28 | expireInterval: 60 * time.Second, |
| 29 | finalize: func(_ any) {}, |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // SetExpireDuration sets the interval at which things expire |
| 34 | // |
no outgoing calls