Documentation ¶
Index ¶
Constants ¶
View Source
const ( NoExpiration = -1 DefaultExpiration = 0 NoPurge = -1 DefaultPurgeInterval = 0 )
View Source
const (
ARC = "arc"
)
View Source
const (
LFU = "lfu"
)
View Source
const (
LRU = "lru"
)
View Source
const (
SIMPLE = "simpleCache"
)
Variables ¶
This section is empty.
Functions ¶
func NewBuilder ¶
NewBuilder receive a constant cache name and a cache size, return a specific cache builder. A error will be returned if the specific cache is not registered or the cache implementation is invalid.
Types ¶
type BeforeEvictedFunc ¶
type BeforeEvictedFunc func(key, value interface{})
type Cache ¶
type Cache interface { Init() Get(key interface{}) (interface{}, error) GetOnlyPresent(key interface{}) (interface{}, bool) Set(key, value interface{}) SetWithExpire(key, value interface{}, duration time.Duration) Has(key interface{}) bool Remove(key interface{}) bool Keys() []interface{} CleanExpired() int Flush() Len() int // contains filtered or unexported methods }
Cache represents a interface used by the user to r/w the cache store.
type KeyNotFoundError ¶
func (*KeyNotFoundError) Error ¶
func (e *KeyNotFoundError) Error() string
type LoaderFunc ¶
type LoaderFunc func(key interface{}) (interface{}, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.