Versions in this module Expand all Collapse all v0 v0.21.0 Jul 29, 2025 Changes in this version + const TYPE_ARC + const TYPE_LFU + const TYPE_LRU + const TYPE_SIMPLE + var KeyNotFoundError = errors.New("Key not found.") + type ARC struct + func (c *ARC) Get(key interface{}) (interface{}, error) + func (c *ARC) GetALL(checkExpired bool) map[interface{}]interface{} + func (c *ARC) GetIFPresent(key interface{}) (interface{}, error) + func (c *ARC) Has(key interface{}) bool + func (c *ARC) Keys(checkExpired bool) []interface{} + func (c *ARC) Len(checkExpired bool) int + func (c *ARC) Purge() + func (c *ARC) Remove(key interface{}) bool + func (c *ARC) Set(key, value interface{}) error + func (c *ARC) SetWithExpire(key, value interface{}, expiration time.Duration) error + type AddedFunc func(any, any) + type Cache interface + Get func(key any) (any, error) + GetALL func(checkExpired bool) map[any]any + GetIFPresent func(key any) (any, error) + Has func(key any) bool + Keys func(checkExpired bool) []any + Len func(checkExpired bool) int + Purge func() + Remove func(key any) bool + Set func(key, value any) error + SetWithExpire func(key, value any, expiration time.Duration) error + type CacheBuilder struct + func New(size int) *CacheBuilder + func (cb *CacheBuilder) ARC() *CacheBuilder + func (cb *CacheBuilder) AddedFunc(addedFunc AddedFunc) *CacheBuilder + func (cb *CacheBuilder) Build() Cache + func (cb *CacheBuilder) Clock(clock Clock) *CacheBuilder + func (cb *CacheBuilder) DeserializeFunc(deserializeFunc DeserializeFunc) *CacheBuilder + func (cb *CacheBuilder) EvictType(tp string) *CacheBuilder + func (cb *CacheBuilder) EvictedFunc(evictedFunc EvictedFunc) *CacheBuilder + func (cb *CacheBuilder) Expiration(expiration time.Duration) *CacheBuilder + func (cb *CacheBuilder) LFU() *CacheBuilder + func (cb *CacheBuilder) LRU() *CacheBuilder + func (cb *CacheBuilder) LoaderExpireFunc(loaderExpireFunc LoaderExpireFunc) *CacheBuilder + func (cb *CacheBuilder) LoaderFunc(loaderFunc LoaderFunc) *CacheBuilder + func (cb *CacheBuilder) PurgeVisitorFunc(purgeVisitorFunc PurgeVisitorFunc) *CacheBuilder + func (cb *CacheBuilder) SerializeFunc(serializeFunc SerializeFunc) *CacheBuilder + func (cb *CacheBuilder) Simple() *CacheBuilder + type Clock interface + Now func() time.Time + func NewRealClock() Clock + type DeserializeFunc func(any, any) (any, error) + type EvictedFunc func(any, any) + type FakeClock interface + Advance func(d time.Duration) + func NewFakeClock() FakeClock + type Group struct + func (g *Group) Do(key interface{}, fn func() (interface{}, error), isWait bool) (interface{}, bool, error) + type LFU struct + func (c *LFU) Get(key interface{}) (interface{}, error) + func (c *LFU) GetALL(checkExpired bool) map[interface{}]interface{} + func (c *LFU) GetIFPresent(key interface{}) (interface{}, error) + func (c *LFU) Has(key interface{}) bool + func (c *LFU) Keys(checkExpired bool) []interface{} + func (c *LFU) Len(checkExpired bool) int + func (c *LFU) Purge() + func (c *LFU) Remove(key interface{}) bool + func (c *LFU) Set(key, value interface{}) error + func (c *LFU) SetWithExpire(key, value interface{}, expiration time.Duration) error + type LRU struct + func (c *LRU) Get(key interface{}) (interface{}, error) + func (c *LRU) GetALL(checkExpired bool) map[interface{}]interface{} + func (c *LRU) GetIFPresent(key interface{}) (interface{}, error) + func (c *LRU) Has(key interface{}) bool + func (c *LRU) Keys(checkExpired bool) []interface{} + func (c *LRU) Len(checkExpired bool) int + func (c *LRU) Purge() + func (c *LRU) Remove(key interface{}) bool + func (c *LRU) Set(key, value interface{}) error + func (c *LRU) SetWithExpire(key, value interface{}, expiration time.Duration) error + type LoaderExpireFunc func(any) (any, *time.Duration, error) + type LoaderFunc func(any) (any, error) + type PurgeVisitorFunc func(any, any) + type RealClock struct + func (rc RealClock) Now() time.Time + type SerializeFunc func(any, any) (any, error)