cache

package
v1.0.0-rc07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultsCache

type DefaultsCache[T any] struct {
	// contains filtered or unexported fields
}

DefaultsCache memoizes generated default configs.

func NewDefaultsCache

func NewDefaultsCache[T any](buildDefault func(string) T) *DefaultsCache[T]

func (*DefaultsCache[T]) GetDefaultConfig

func (c *DefaultsCache[T]) GetDefaultConfig(clusterName string) T

func (*DefaultsCache[T]) Invalidate

func (c *DefaultsCache[T]) Invalidate(clusterName string)

func (*DefaultsCache[T]) InvalidateAll

func (c *DefaultsCache[T]) InvalidateAll()

func (*DefaultsCache[T]) Stats

func (c *DefaultsCache[T]) Stats() Stats

type Entry

type Entry[T any] struct {
	Value     T
	LoadedAt  time.Time
	ExpiresAt time.Time
}

type NamedCache

type NamedCache[T any] struct {
	// contains filtered or unexported fields
}

NamedCache is a generic in-memory cache keyed by configuration name.

func NewNamedCache

func NewNamedCache[T any]() *NamedCache[T]

func (*NamedCache[T]) Clear

func (c *NamedCache[T]) Clear(ctx context.Context)

func (*NamedCache[T]) Get

func (c *NamedCache[T]) Get(ctx context.Context, name string) (T, bool)

func (*NamedCache[T]) Invalidate

func (c *NamedCache[T]) Invalidate(ctx context.Context, name string)

func (*NamedCache[T]) Set

func (c *NamedCache[T]) Set(ctx context.Context, name string, value T)

func (*NamedCache[T]) SetWithExpiration

func (c *NamedCache[T]) SetWithExpiration(ctx context.Context, name string, value T, expiresAt time.Time)

func (*NamedCache[T]) Size

func (c *NamedCache[T]) Size() int

type Stats

type Stats struct {
	DefaultConfigCount  int
	CompleteConfigCount int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL