Documentation
¶
Index ¶
- Variables
- type Cache
- type Conn
- type Convert
- type Hash
- type Key
- type List
- type Option
- func WithDB(db int) Option
- func WithDialConnectTimeout(timeout time.Duration) Option
- func WithDialReadTimeout(timeout time.Duration) Option
- func WithDialWriteTimeout(timeout time.Duration) Option
- func WithHost(host string) Option
- func WithIdleTimeout(timeout time.Duration) Option
- func WithMaxActive(maxActive int) Option
- func WithMaxIdle(maxIdle int) Option
- func WithPassword(password string) Option
- func WithPort(port int) Option
- func WithWait(wait bool) Option
- type Set
- type SortedSet
- type String
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Open() error
Close() error
DO(cmd string, args ...interface{}) (interface{}, error)
Conn() Conn
Convert
Key
String
Hash
List
Set
SortedSet
// contains filtered or unexported methods
}
Cache 缓存
type Convert ¶
type Convert interface {
Int(reply interface{}, err error) (int, error)
Int64(reply interface{}, err error) (int64, error)
Uint64(reply interface{}, err error) (uint64, error)
Float64(reply interface{}, err error) (float64, error)
String(reply interface{}, err error) (string, error)
Bytes(reply interface{}, err error) ([]byte, error)
Bool(reply interface{}, err error) (bool, error)
Float64s(reply interface{}, err error) ([]float64, error)
Int64s(reply interface{}, err error) ([]int64, error)
Ints(reply interface{}, err error) ([]int, error)
ByteSlices(reply interface{}, err error) ([][]byte, error)
Strings(reply interface{}, err error) ([]string, error)
StringMap(reply interface{}, err error) (map[string]string, error)
IntMap(reply interface{}, err error) (map[string]int, error)
Int64Map(reply interface{}, err error) (map[string]int64, error)
Values(reply interface{}, err error) ([]interface{}, error)
}
Convert 数据转换
type Hash ¶
type Hash interface {
HGet(key, field string) (string, error)
HSet(key, field string, value interface{}) error
HMGet(v ...interface{}) ([]string, error)
HMSet(v ...interface{}) error
HGetAll(key string) ([]string, error)
HExists(key, field string) (bool, error)
HDel(v ...interface{}) (int, error)
HLen(key string) (int, error)
HIncrby(key, field string, increment int) (int, error)
HIncrbyFloat(key, field string, increment float64) (float64, error)
}
Hash 哈希表
type Key ¶
type Key interface {
Del(key ...interface{}) (int, error)
Exists(key string) (bool, error)
Expire(key, ex string) (bool, error)
ExpireAt(key string, t int) (bool, error)
PExpire(key, ex string) (bool, error)
PExpireAt(key string, t int) (bool, error)
TTL(key string) (int, error)
PTTL(key string) (int, error)
}
Key 键
type List ¶
type List interface {
LPush(v ...interface{}) (int, error)
LPop(key string) (string, error)
RPush(v ...interface{}) (int, error)
RPop(key string) (string, error)
RPopLPush(source, destination string) (string, error)
LTrim(key string, start, stop int) error
LSet(key string, index int, value string) error
LRem(key string, count int, value string) (int, error)
LRange(key string, start, stop int) ([]string, error)
LLen(key string) (int, error)
LInsertBefore(key, pivot, value string) (int, error)
LInsertAfter(key, pivot, value string) (int, error)
LIndex(key string, index int) (string, error)
}
List 列表
type Option ¶
type Option func(Cache)
Option ..
func WithDialConnectTimeout ¶
WithDialConnectTimeout ..
func WithDialReadTimeout ¶
WithDialReadTimeout ..
func WithDialWriteTimeout ¶
WithDialWriteTimeout ..
type Set ¶
type Set interface {
SAdd(v ...interface{}) (int, error)
SCard(key string) (int, error)
SDiff(key ...interface{}) ([]string, error)
SDiffStore(key ...interface{}) (int, error)
SUnion(key ...interface{}) ([]string, error)
SUnionStore(key ...interface{}) (int, error)
SInter(key ...interface{}) ([]string, error)
SInterStore(key ...interface{}) (int, error)
SIsMember(key, member string) (bool, error)
SMembers(key string) ([]string, error)
SPop(key string) (string, error)
SRandMember(key string, count int) ([]string, error)
SRem(v ...interface{}) (int, error)
}
Set 集合
type SortedSet ¶
type SortedSet interface {
ZAdd(v ...interface{}) (int, error)
ZCard(key string) (int, error)
ZCount(key string, min int, max int) (int, error)
ZIncrby(key, member string, incrment int) (int, error)
ZRange(key string, start, stop int) ([]string, error)
ZRangeWithScores(key string, start, stop int) ([]string, error)
ZScore(key, member string) (int, error)
ZRank(key, member string) (int, error)
ZRangeByScore(key string, min, max, limit, offset, count int) ([]string, error)
ZRevRank(key, member string) (int, error)
ZRevRangeByScore(key string, max, min, limit, offset, count int) ([]string, error)
ZRevRange(key string, start, stop int) ([]string, error)
ZRemRangeByScore(key string, min, max int) (int, error)
ZRemRangeByRank(key string, start, stop int) (int, error)
ZRem(v ...interface{}) (int, error)
}
SortedSet 有序集合
type String ¶
type String interface {
Get(key string) (string, error)
GetBytes(key string) ([]byte, error)
Set(key string, value interface{}) error
SetEx(key string, value interface{}, seconds string) error
PSetEx(key string, value interface{}, milliseconds string) error
MGet(key ...interface{}) ([]string, error)
MSet(v ...interface{}) error
Append(key string, value interface{}) (int, error)
Strlen(key string) (int, error)
Incr(key string) (int64, error)
Incrby(key string, increment int64) (int64, error)
Decr(key string) (int64, error)
Decrby(key string, decrement int64) (int64, error)
GetSet(key string, value interface{}) (string, error)
}
String 字符串
Source Files
¶
Click to show internal directories.
Click to hide internal directories.