Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache interface {
// SetTTL set default ttl
SetDefaultTTL(ttl time.Duration)
// set cached value with key and expire time.
Put(key string, val interface{}) error
// set cached value with key and expire time.
PutWithTTL(key string, val interface{}, ttl time.Duration) error
// get cached value by key.
Get(key string, val interface{}) error
// delete cached value by key.
Delete(key string) error
// check if cached value exists or not.
IsExist(key string) bool
// clear all cache.
ClearAll() 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
// close cache
Close() error
// 携带上下文
WithContext(ctx context.Context) Cache
}
Cache provides the interface for cache implementations.
Click to show internal directories.
Click to hide internal directories.