store

package
v0.0.0-...-7c381ef Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvictionStrategy

type EvictionStrategy interface {
	OnAccess(key string)
	OnInsert(key string, size int)
	OnDelete(key string)
	Evict(data map[string][]byte) (evictedKey string, shouldEvict bool)
	Reset()
}

func NewEvictionStrategy

func NewEvictionStrategy(policy v1alpha.EvictionPolicy, capacity int) EvictionStrategy

type LRUStrategy

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

func NewLRUStrategy

func NewLRUStrategy(capacity int) *LRUStrategy

func (*LRUStrategy) Evict

func (l *LRUStrategy) Evict(data map[string][]byte) (string, bool)

func (*LRUStrategy) OnAccess

func (l *LRUStrategy) OnAccess(key string)

func (*LRUStrategy) OnDelete

func (l *LRUStrategy) OnDelete(key string)

func (*LRUStrategy) OnInsert

func (l *LRUStrategy) OnInsert(key string, size int)

func (*LRUStrategy) Reset

func (l *LRUStrategy) Reset()

type MapStore

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

func NewMapStore

func NewMapStore(strategy EvictionStrategy) *MapStore

func (*MapStore) Clear

func (m *MapStore) Clear()

func (*MapStore) Delete

func (m *MapStore) Delete(key string) error

func (*MapStore) Get

func (m *MapStore) Get(key string) ([]byte, error)

func (*MapStore) List

func (m *MapStore) List() []string

func (*MapStore) Set

func (m *MapStore) Set(key string, value []byte) error

func (*MapStore) This

func (m *MapStore) This() map[string][]byte

type Store

type Store interface {
	Set(key string, value []byte) error
	Get(key string) ([]byte, error)
	Delete(key string) error
	Clear()
	List() []string
	This() map[string][]byte
}

func NewStore

func NewStore(engine v1alpha.StoreEngine, policy v1alpha.EvictionPolicy) Store

type StoreError

type StoreError string
const StoreErrorKeyNotFound StoreError = "key not found"

func (StoreError) Error

func (e StoreError) Error() string

type SyncMapStore

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

func NewSyncMapStore

func NewSyncMapStore() *SyncMapStore

func (*SyncMapStore) Clear

func (s *SyncMapStore) Clear()

func (*SyncMapStore) Delete

func (s *SyncMapStore) Delete(key string) error

func (*SyncMapStore) Get

func (s *SyncMapStore) Get(key string) ([]byte, error)

func (*SyncMapStore) List

func (s *SyncMapStore) List() []string

func (*SyncMapStore) Set

func (s *SyncMapStore) Set(key string, value []byte) error

func (*SyncMapStore) This

func (s *SyncMapStore) This() map[string][]byte

Jump to

Keyboard shortcuts

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