Releases: motoki317/sc
Releases · motoki317/sc
v1.0.0
sc v1.0.0
sc is a simple golang in-memory caching library, with easily configurable implementations.
Notable Features
- Simple to use; the only methods are Get(), GetFresh(), and Forget().
- There is no Set() method - this is an intentional design choice to make the use easier.
- Supports 1.18 generics - both key and value are generic.
- No
interface{}
even in internal implementations.
- No
- Supported cache backends
- Built-in map (default) - lightweight, but does not evict items.
- LRU (
WithLRUBackend(cap)
option) - automatically evicts overflown items.
- Prevents cache stampede problem idiomatically.
- All methods are safe to be called from multiple goroutines.
- Allows graceful cache replacement (if
freshFor
<ttl
) - only one goroutine is launched in the background to re-fetch the value. - Allows strict request coalescing (
EnableStrictCoalescing()
option) - ensures that all returned values are fresh (a niche use-case).
Usage
See reference.