Documentation ¶
Index ¶
- type CacheConfig
- type ImmunityCache
- func (ic *ImmunityCache) Clear()
- func (ic *ImmunityCache) Close() error
- func (ic *ImmunityCache) Count() int
- func (ic *ImmunityCache) CountImmune() int
- func (ic *ImmunityCache) Diagnose(_ bool)
- func (ic *ImmunityCache) ForEachItem(function storage.ForEachItem)
- func (ic *ImmunityCache) Get(key []byte) (value interface{}, ok bool)
- func (ic *ImmunityCache) Has(key []byte) bool
- func (ic *ImmunityCache) HasOrAdd(key []byte, value interface{}, sizeInBytes int) (has, added bool)
- func (ic *ImmunityCache) ImmunizeKeys(keys [][]byte) (numNowTotal, numFutureTotal int)
- func (ic *ImmunityCache) IsInterfaceNil() bool
- func (ic *ImmunityCache) Keys() [][]byte
- func (ic *ImmunityCache) Len() int
- func (ic *ImmunityCache) MaxSize() int
- func (ic *ImmunityCache) NumBytes() int
- func (ic *ImmunityCache) Peek(key []byte) (value interface{}, ok bool)
- func (ic *ImmunityCache) Put(key []byte, value interface{}, sizeInBytes int) (evicted bool)
- func (ic *ImmunityCache) RegisterHandler(func(key []byte, value interface{}), string)
- func (ic *ImmunityCache) Remove(key []byte)
- func (ic *ImmunityCache) RemoveOldest()
- func (ic *ImmunityCache) RemoveWithResult(key []byte) bool
- func (ic *ImmunityCache) SizeInBytesContained() uint64
- func (ic *ImmunityCache) UnRegisterHandler(_ string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
type CacheConfig struct { Name string NumChunks uint32 MaxNumItems uint32 MaxNumBytes uint32 NumItemsToPreemptivelyEvict uint32 }
CacheConfig holds cache configuration
func (*CacheConfig) String ¶
func (config *CacheConfig) String() string
String returns a readable representation of the object
func (*CacheConfig) Verify ¶
func (config *CacheConfig) Verify() error
Verify verifies the validity of the configuration
type ImmunityCache ¶
type ImmunityCache struct {
// contains filtered or unexported fields
}
ImmunityCache is a cache-like structure
func NewImmunityCache ¶
func NewImmunityCache(config CacheConfig) (*ImmunityCache, error)
NewImmunityCache creates a new cache
func (*ImmunityCache) Close ¶
func (ic *ImmunityCache) Close() error
Close does nothing for this cacher implementation
func (*ImmunityCache) Count ¶
func (ic *ImmunityCache) Count() int
Count returns the number of elements within the map
func (*ImmunityCache) CountImmune ¶
func (ic *ImmunityCache) CountImmune() int
CountImmune returns the number of immunized (current or future) elements within the map
func (*ImmunityCache) Diagnose ¶
func (ic *ImmunityCache) Diagnose(_ bool)
Diagnose displays a summary of the internal state of the cache
func (*ImmunityCache) ForEachItem ¶
func (ic *ImmunityCache) ForEachItem(function storage.ForEachItem)
ForEachItem iterates over the items in the cache
func (*ImmunityCache) Get ¶
func (ic *ImmunityCache) Get(key []byte) (value interface{}, ok bool)
Get gets an item (payload) by key
func (*ImmunityCache) Has ¶
func (ic *ImmunityCache) Has(key []byte) bool
Has checks is an item exists
func (*ImmunityCache) HasOrAdd ¶
func (ic *ImmunityCache) HasOrAdd(key []byte, value interface{}, sizeInBytes int) (has, added bool)
HasOrAdd adds an item in the cache
func (*ImmunityCache) ImmunizeKeys ¶
func (ic *ImmunityCache) ImmunizeKeys(keys [][]byte) (numNowTotal, numFutureTotal int)
ImmunizeKeys marks items as immune to eviction
func (*ImmunityCache) IsInterfaceNil ¶
func (ic *ImmunityCache) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ImmunityCache) MaxSize ¶
func (ic *ImmunityCache) MaxSize() int
MaxSize returns the capacity of the cache
func (*ImmunityCache) NumBytes ¶
func (ic *ImmunityCache) NumBytes() int
NumBytes estimates the size of the cache, in bytes
func (*ImmunityCache) Peek ¶
func (ic *ImmunityCache) Peek(key []byte) (value interface{}, ok bool)
Peek gets an item
func (*ImmunityCache) Put ¶
func (ic *ImmunityCache) Put(key []byte, value interface{}, sizeInBytes int) (evicted bool)
Put adds an item in the cache
func (*ImmunityCache) RegisterHandler ¶
func (ic *ImmunityCache) RegisterHandler(func(key []byte, value interface{}), string)
RegisterHandler is not implemented
func (*ImmunityCache) RemoveOldest ¶
func (ic *ImmunityCache) RemoveOldest()
RemoveOldest is not implemented
func (*ImmunityCache) RemoveWithResult ¶
func (ic *ImmunityCache) RemoveWithResult(key []byte) bool
RemoveWithResult removes an item TODO: In the future, add this method to the "storage.Cacher" interface. EN-6739.
func (*ImmunityCache) SizeInBytesContained ¶
func (ic *ImmunityCache) SizeInBytesContained() uint64
SizeInBytesContained returns 0
func (*ImmunityCache) UnRegisterHandler ¶
func (ic *ImmunityCache) UnRegisterHandler(_ string)
UnRegisterHandler removes the handler from the list