Repository navigation
v0.3.0
Typed views now support loaders: concurrent misses for the same key through one View share a single upstream call while all value types continue to use the parent cache's byte budget.
- Add
ViewOptions.LoaderandView.GetOrLoad, with typed results, per-view cost and TTLs, negative caching, cancellation and panic handling matchingCache.GetOrLoad. - Add
ViewStats.Loads,LoadErrorsandCoalesced, also included in parent-cache statistics. - Add runnable basic-cache and HTTP-loader examples, an executable view-loader example, and updated getting-started documentation.
Reuse one View instance to share in-flight work. Loaders receive unprefixed keys; separate view instances and the parent cache have independent loaders. A view without its own loader returns ErrNoLoader.
Compatibility: ViewOptions and ViewStats gained fields. Replace positional struct literals with named fields. Go 1.24 remains the minimum; the library has no dependencies.
Install:
go get github.com/andared/sanecache@v0.3.0Full changelog: v0.2.0...v0.3.0