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) 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
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) List ¶
func (s *SyncMapStore) List() []string
func (*SyncMapStore) This ¶
func (s *SyncMapStore) This() map[string][]byte
Click to show internal directories.
Click to hide internal directories.