cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K comparable, V any] interface {
	Add(K, V) (evicted bool)
	Purge()
	Get(K) (value V, ok bool)
	Remove(K) (present bool)
}

Cache is the contract of the cache implementation

type InMemory

type InMemory[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewInMemory

func NewInMemory[K comparable, V any]() *InMemory[K, V]

func (*InMemory[K, V]) Add

func (m *InMemory[K, V]) Add(flagKey K, value V) (evicted bool)

func (*InMemory[K, V]) Get

func (m *InMemory[K, V]) Get(flagKey K) (value V, ok bool)

func (*InMemory[K, V]) Purge

func (m *InMemory[K, V]) Purge()

func (*InMemory[K, V]) Remove

func (m *InMemory[K, V]) Remove(flagKey K) (present bool)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewCacheService

func NewCacheService(cacheType Type, maxCacheSize int, log logr.Logger) *Service

func (*Service) Disable

func (s *Service) Disable()

func (*Service) GetCache

func (s *Service) GetCache() Cache[string, interface{}]

func (*Service) IsEnabled

func (s *Service) IsEnabled() bool

type Type

type Type string
const (
	LRUValue      Type = "lru"
	InMemValue    Type = "mem"
	DisabledValue Type = "disabled"
)

Jump to

Keyboard shortcuts

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