cache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCaching

func AddCaching(s *session.Session, cacheConfig *Config)

AddCaching adds caching to the Session

func IsCacheHit

func IsCacheHit(ctx context.Context) bool

IsCacheHit returns true if the context was used for a cached API request

Types

type Config

type Config struct {
	DefaultTTL                time.Duration
	BackgroundPruningInterval time.Duration

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(defaultTTL, backgroundPruning time.Duration, maxSize int64, itemsToPrune uint32) *Config

NewConfig returns a cache configuration with the defaultTTL

func (*Config) FlushCache

func (c *Config) FlushCache(serviceName string)

FlushCache flushes all caches for a service

func (*Config) FlushOperationCache

func (c *Config) FlushOperationCache(serviceName, operationName string)

func (*Config) NewCacheCollector

func (c *Config) NewCacheCollector(namespace string) prometheus.Collector

func (*Config) SetCacheMutating

func (c *Config) SetCacheMutating(serviceName, operationName string, isMutating bool)

SetCacheMutating sets a specific operation to mutating/non-mutating

func (*Config) SetCacheTTL

func (c *Config) SetCacheTTL(serviceName, operationName string, ttl time.Duration)

SetCacheTTL sets a unique TTL for the service and operation

func (*Config) SetExcludeFlushing

func (c *Config) SetExcludeFlushing(serviceName, operationName string, isExcluded bool)

SetExcludeFlushing sets a specific operation to never flush on mutation, only TTL

Jump to

Keyboard shortcuts

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