Documentation ¶
Index ¶
- func NewCapacityLRU(size int, byteCapacity int64) (storage.AdaptedSizedLRUCache, error)
- func NewImmunityCache(config CacheConfig) (*immunitycache.ImmunityCache, error)
- func NewLRUCache(size int) (storage.Cacher, error)
- func NewLRUCacheWithEviction(size int, onEvicted func(key interface{}, value interface{})) (storage.Cacher, error)
- func NewTimeCache(defaultSpan time.Duration) *timecache.TimeCache
- func NewTimeCacher(arg ArgTimeCacher) (storage.Cacher, error)
- type ArgTimeCacher
- type CacheConfig
- type EvictionHandler
- type ImmunityCache
- type PeerBlackListCacher
- type TimeCache
- type TimeCacher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCapacityLRU ¶
func NewCapacityLRU(size int, byteCapacity int64) (storage.AdaptedSizedLRUCache, error)
NewCapacityLRU constructs an LRU cache of the given size with a byte size capacity
func NewImmunityCache ¶
func NewImmunityCache(config CacheConfig) (*immunitycache.ImmunityCache, error)
NewImmunityCache creates a new cache
func NewLRUCache ¶
NewLRUCache returns an instance of a LRU cache
func NewLRUCacheWithEviction ¶
func NewLRUCacheWithEviction(size int, onEvicted func(key interface{}, value interface{})) (storage.Cacher, error)
NewLRUCacheWithEviction creates a new sized LRU cache instance with eviction function
func NewTimeCache ¶
NewTimeCache returns an instance of a time cache
func NewTimeCacher ¶
func NewTimeCacher(arg ArgTimeCacher) (storage.Cacher, error)
NewTimeCacher creates a new timeCacher
Types ¶
type ArgTimeCacher ¶
type ArgTimeCacher = timecache.ArgTimeCacher
ArgTimeCacher is the argument used to create a new timeCacher instance
type CacheConfig ¶
type CacheConfig = immunitycache.CacheConfig
CacheConfig holds cache configuration
type EvictionHandler ¶
type EvictionHandler = types.EvictionHandler
EvictionHandler is an alias to the imported EvictionHandler
type ImmunityCache ¶
type ImmunityCache = immunitycache.ImmunityCache
ImmunityCache is a cache-like structure
type PeerBlackListCacher ¶
type PeerBlackListCacher interface { Upsert(pid core.PeerID, span time.Duration) error Has(pid core.PeerID) bool Sweep() IsInterfaceNil() bool }
PeerBlackListCacher can determine if a certain peer id is or not blacklisted
func NewPeerTimeCache ¶
func NewPeerTimeCache(cache TimeCacher) (PeerBlackListCacher, error)
NewPeerTimeCache returns an instance of a peer time cacher