Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCacheMiss = errors.New("cache miss")
)
Functions ¶
Types ¶
type Cache ¶
type Cache interface {
// get cached value by key.
Get(key string, dest interface{}) error
// GetMulti is a batch version of Get.
GetMulti(keys []string) []interface{}
// set cached value with key and expire time.
Set(key string, val interface{}, timeout time.Duration) error
// delete cached value by key.
Delete(key string) error
// 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.
FlushAll() error
// start gc routine based on config string settings.
StartAndGC(config map[string]interface{}) error
}
type CodecInterface ¶
type CodecInterface interface {
Marshal(interface{}) (interface{}, error)
Unmarshal([]byte, interface{}) error
}
the remote cache server need serialize and derialize data
Click to show internal directories.
Click to hide internal directories.