Documentation
¶
Index ¶
- Constants
- func Get(ctx context.Context) *resolverCache
- func GetFromCacheOrResolve(ctx context.Context, params []v1.Param, resolverType string, resolve resolveFn) (resolutionframework.ResolvedResource, error)
- func ShouldUse(ctx context.Context, resolver ImmutabilityChecker, params []v1.Param, ...) bool
- func Validate(cacheMode string) error
- type CacheConfigStore
- type Clock
- type Config
- type ImmutabilityChecker
Constants ¶
const (
CacheParam = "cache"
)
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get extracts the ResolverCache from the context. If the cache is not available in the context (e.g., in tests), it falls back to the shared cache with a logger from the context.
func GetFromCacheOrResolve ¶
func GetFromCacheOrResolve( ctx context.Context, params []v1.Param, resolverType string, resolve resolveFn, ) (resolutionframework.ResolvedResource, error)
func ShouldUse ¶
func ShouldUse( ctx context.Context, resolver ImmutabilityChecker, params []v1.Param, resolverType string, ) bool
ShouldUse determines whether caching should be used based on: 1. Task/Pipeline cache parameter (highest priority) 2. ConfigMap default-cache-mode (middle priority) 3. System default for resolver type (lowest priority)
Types ¶
type CacheConfigStore ¶
type CacheConfigStore struct {
// contains filtered or unexported fields
}
func NewCacheConfigStore ¶
func NewCacheConfigStore(cacheConfigName string, logger configmap.Logger) *CacheConfigStore
func (*CacheConfigStore) GetResolverConfig ¶
func (store *CacheConfigStore) GetResolverConfig() *Config
func (*CacheConfigStore) ToContext ¶
func (store *CacheConfigStore) ToContext(ctx context.Context) context.Context
ToContext returns a new context with the cache's configuration data stored in it.
func (*CacheConfigStore) WatchConfigs ¶
func (store *CacheConfigStore) WatchConfigs(w configmap.Watcher)
type Clock ¶
Clock is an interface for getting the current time. This allows for testing without relying on actual time for timestamp generation. Note: The underlying k8s LRUExpireCache uses real time for TTL expiration checks, so we cannot use a fake clock to control cache expiration in tests.
type ImmutabilityChecker ¶
ImmutabilityChecker extends the base Resolver interface with cache-specific methods. Each resolver implements IsImmutable to define what "auto" mode means in their context.