DefaultConfig returns a default configuration for the cache.
()
| 55 | |
| 56 | // DefaultConfig returns a default configuration for the cache. |
| 57 | func DefaultConfig() Config { |
| 58 | return Config{ |
| 59 | DefaultTTL: 10 * time.Minute, |
| 60 | CleanupInterval: 5 * time.Minute, |
| 61 | MaxItems: 1000, |
| 62 | OnEviction: nil, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // Cache is a thread-safe in-memory cache with TTL and memory management. |
| 67 | type Cache struct { |
no outgoing calls