MCPcopy
hub / github.com/kubernetes-sigs/headlamp / Cache

Interface Cache

backend/pkg/cache/cache.go:30–39  ·  view source on GitHub ↗

Cache is an interface for a cache that can be used to store and retrieve values.

Source from the content-addressed store, hash-verified

28// Cache is an interface for a cache
29// that can be used to store and retrieve values.
30type Cache[T any] interface {
31 Set(ctx context.Context, key string, value T) error
32 SetWithTTL(ctx context.Context, key string, value T, ttl time.Duration) error
33 Delete(ctx context.Context, key string) error
34 Get(ctx context.Context, key string) (T, error)
35 GetAll(ctx context.Context, selectFunc Matcher) (map[string]T, error)
36 UpdateTTL(ctx context.Context, key string, ttl time.Duration) error
37 SetOnEvicted(f func(key string, value T))
38 Close() error
39}
40
41// Matcher is a function that returns true if the key matches.
42type Matcher func(key string) bool

Callers 48

testCacheFunction · 0.65
TestCacheGetAllFunction · 0.65
cookies_test.goFile · 0.65
CacheRefreshedTokenFunction · 0.65
writeMeJSONFunction · 0.65
TestParseClusterAndTokenFunction · 0.65
newTokenServerJSONFunction · 0.65
newOIDCProviderServerFunction · 0.65
testCacheFunction · 0.65
CacheRefreshedTokenFunction · 0.65
StoreK8sResponseInCacheFunction · 0.65

Implementers 1

MockCachebackend/pkg/k8cache/cacheStore_test.go

Calls

no outgoing calls

Tested by

no test coverage detected