go-cache is a thread-safe, in-memory cache library for Go that stores arbitrary objects with per-item expiration timestamps. It provides a concurrent key-value store where multiple goroutines can safely read and write shared cached data without external synchronization, using a mutex-guarded map for access control.
The library distinguishes itself through its expiration management and optional disk persistence. Each cached item carries its own time-to-live, and a background goroutine periodically purges expired entries. The cache can serialize its entire contents to disk using Go's gob encoding format, allowing cached data to survive application restarts and be reloaded on startup.
The library supports storing any Go object with configurable expiration durations, from temporary entries to items that persist indefinitely. Its file serialization uses gob encoding for type-safe cross-version compatibility, making it suitable for single-machine applications that need a lightweight alternative to external caching systems.