Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ValueNotExistError = errors.New("value not exist") InvalidValueTypeError = errors.New("invalid value type") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// get cached value by key.
Get(key string) interface{}
// GetOrElse return value if it exists, else warmup using warmup function
GetOrElse(key string, warmUpFunc func(key string) interface{}, expire ...int64) interface{}
// GetMulti is a batch version of Get.
GetMulti(keys []string) []interface{}
// set cached value with key and expire time.
Set(key string, val interface{}, expire int64)
// delete cached value by key.
Delete(key string)
// increase cached int value by key, as a counter.
Incr(key string) error
// decrease cached int value by key, as a counter.
Decr(key string) error
// check if cached value exists or not.
IsExist(key string) bool
// clear all cache.
ClearAll()
// contains filtered or unexported methods
}
func NewMemoryCache ¶
Click to show internal directories.
Click to hide internal directories.