Versions in this module Expand all Collapse all v0 v0.1.0 Jun 21, 2026 Changes in this version + var ErrClosed = errors.New("nimbus: cache closed") + var ErrNotFound = errors.New("nimbus: not found") + type Builder struct + func NewBuilder[K comparable, V any](loader Loader[K, V]) *Builder[K, V] + func (b *Builder[K, V]) BackgroundRefresh(workers int) *Builder[K, V] + func (b *Builder[K, V]) Build() (Cache[K, V], error) + func (b *Builder[K, V]) Bus(bus invalidation.Bus) *Builder[K, V] + func (b *Builder[K, V]) Clock(c clock.Clock) *Builder[K, V] + func (b *Builder[K, V]) Jitter(frac float64) *Builder[K, V] + func (b *Builder[K, V]) KeyString(fn func(K) string) *Builder[K, V] + func (b *Builder[K, V]) L1(s store.Store[V]) *Builder[K, V] + func (b *Builder[K, V]) L2(s store.VersionedStore[V]) *Builder[K, V] + func (b *Builder[K, V]) MaxConcurrentRefresh(n int) *Builder[K, V] + func (b *Builder[K, V]) MaxTTL(d time.Duration) *Builder[K, V] + func (b *Builder[K, V]) NegativeTTL(d time.Duration) *Builder[K, V] + func (b *Builder[K, V]) RefreshMode(m RefreshMode) *Builder[K, V] + func (b *Builder[K, V]) RefreshTimeout(d time.Duration) *Builder[K, V] + func (b *Builder[K, V]) TTL(fresh, staleWindow time.Duration) *Builder[K, V] + type Cache interface + Close func() error + Get func(ctx context.Context, key K) (V, bool, error) + GetOrLoad func(ctx context.Context, key K) (V, error) + Invalidate func(ctx context.Context, key K) error + InvalidateTag func(ctx context.Context, tag string) error + Set func(ctx context.Context, key K, val V, opts ...EntryOption) error + Stats func() Stats + type EntryOption interface + func WithTags(tags ...string) EntryOption + type Loader func(ctx context.Context, key K) (V, error) + type RefreshMode int + const RefreshBackground + const RefreshRequestBound + func (m RefreshMode) String() string + type Stats struct + BusEvicts uint64 + Evictions uint64 + Hits uint64 + L1Len int + L2Errors uint64 + LoadErrors uint64 + Loads uint64 + Misses uint64 + NegativeHits uint64 + Refreshes uint64 + StaleHits uint64