Documentation
¶
Index ¶
- Constants
- func AddKK(h string) string
- func Close()
- func Conn() *redis.Conn
- func ConnClose(c *redis.Conn)
- func Del(k string) error
- func Exists(k string) (bool, error)
- func Expire(k string, ttl int) (bool, error)
- func ExpireAt(k string, tm time.Time) (bool, error)
- func FlushDB()
- func Get(k string) (value interface{}, err error)
- func GetStr(k string) (string, error)
- func GetTo(k string, v interface{}) error
- func HClear(h string) error
- func HDel(h, k string) error
- func HExists(h, k string) (bool, error)
- func HExistsNotErr(h, k string) bool
- func HGet(h, k string) (v interface{}, err error)
- func HGetAll(h string) (map[string]interface{}, error)
- func HGetAllMapStrInt(h string) (map[string]int, error)
- func HGetAllOriginal(h string) (map[string]string, error)
- func HGetF64(h, k string) (v float64, err error)
- func HGetInt(h, k string) (v int, err error)
- func HGetInt64(h, k string) (v int64, err error)
- func HGetNotUnpack(h, k string) (string, error)
- func HGetStr(h, k string) (v string, err error)
- func HGetTo(h, k string, v interface{}) error
- func HIncr(h, k string) (int, error)
- func HIncrBy(h, k string, v int) (int, error)
- func HIncrByFloat(key, field string, incr float64) (float64, error)
- func HIncrGet(h, k string) (int, error)
- func HIncrId(h, k string, digit int) (int, error)
- func HIncrSet(h, k string, v int) (int, error)
- func HKeys(h string) ([]string, error)
- func HKeysPrefix(h, prefix string) ([]string, error)
- func HLen(h string) (int, error)
- func HScan(h string, cursor uint64, match string, count int, onlyKeys ...bool) (map[string]interface{}, uint64, error)
- func HScanMatch(h string, match string) (map[string]interface{}, error)
- func HScanNotUnpack(h string, cursor uint64, prefix string, count int) ([]string, uint64, error)
- func HScanPrefix(h string, prefix string) (map[string]interface{}, error)
- func HSet(h, k string, v interface{}) error
- func HSetEncrypt(h, k string, v interface{}, key string) error
- func HValues(h string) ([]interface{}, error)
- func HValuesByPrefix(h, prefix string) ([]interface{}, error)
- func HValuesByPrefixStr(h, prefix string) ([]string, error)
- func HValuesNotUnpack(h string) ([]string, error)
- func HValuesTo(h string, p interface{}) error
- func HValuesToByPrefix(h, prefix string, p interface{}) error
- func HkeysPrefixIteratorOriginal(h, prefix string) ([]string, error)
- func HmDel(h string, ks []string) error
- func HmDelByPrefix(h string, prefix string) error
- func HmGet(h string, ks []string) ([]interface{}, error)
- func HmGetTo(h string, ks []string, p interface{}) error
- func HmSet(h string, kvm map[string]interface{}) error
- func HmSetEncrypt(h string, kvm map[string]interface{}, key string) error
- func HmSetOriginal(h string, kvm map[string]interface{}) error
- func Incr(k string) (int, error)
- func IncrBy(k string, v int) (int, error)
- func Info() string
- func Keys(pattern string) ([]string, error)
- func KeysByPrefix(prefix string) ([]string, error)
- func KeysIterator(prefix string) ([]string, error)
- func LIndex(key string, index int) (string, error)
- func LInsertAfter(key string, pivot, value interface{}) (int, error)
- func LInsertBefore(key string, pivot, value interface{}) (int, error)
- func LLen(key string) (int, error)
- func LPop(key string) (string, error)
- func LPush(key string, value interface{}) error
- func LPushX(key string, value interface{}) error
- func LRange(key string, start, stop int) ([]string, error)
- func LRem(key string, count int, value interface{}) (int, error)
- func LSet(key string, index int, value interface{}) error
- func LTrim(key string, start, stop int) error
- func MDel(s []string) error
- func MDelByPrefix(prefix string) error
- func MGet(ks []string) ([]interface{}, error)
- func MSet(kvm map[string]interface{}) error
- func Open(HostPort ...string) error
- func RPop(key string) (string, error)
- func RPopLPush(src, dst string) (string, error)
- func RPush(key string, value interface{}) error
- func RPushX(key string, value interface{}) error
- func Scan(match string) ([]string, error)
- func Set(k string, v interface{}) error
- func SetX(k string, v interface{}, ttl int) error
- func TTL(k string) (time.Duration, error)
- func Type(k string) (string, error)
- func VersionHashName(hashName string) string
Constants ¶
View Source
const Nil = redis.Nil
Variables ¶
This section is empty.
Functions ¶
func ExpireAt ¶
ExpireAt 的作用和 Expire,都用于为 key 设置生存时间。 不同在于 ExpireAt 命令接受的时间参数是 Unix 时间戳 Unix timestamp 。 time.Now().Add(time.Hour) time.Now().Add(900 * time.Millisecond)
func Get ¶
返回key的value。
如果key不存在,返回特殊值nil。 如果key的value不是string,就返回错误,因为GET只处理string类型的values。
返回值
simple-string-reply:key对应的value,或者nil(key不存在时)
func HExistsNotErr ¶
func HGetNotUnpack ¶
func HKeysPrefix ¶
func HScanNotUnpack ¶
func HSetEncrypt ¶
func HValuesByPrefix ¶
func HValuesByPrefixStr ¶
func HValuesNotUnpack ¶
func HValuesToByPrefix ¶
func HmDelByPrefix ¶
func HmSetOriginal ¶
func IncrBy ¶
将key对应的数字加decrement。 1. 如果key不存在,操作之前,key就会被置为0。 2. 如果key的value类型错误或是个不能表示成数字 返回错误: ERR value is not an integer or out of range
func Keys ¶
查找所有符合给定模式pattern(正则表达式)的 key 。 Warning: 生产环境使用 KEYS 命令需要非常小心。 在大的数据库上执行命令会影响性能, 不要在你的代码中使用 KEYS 如果你需要一个寻找键空间中的key子集,考虑使用SCAN 或 sets
支持的匹配模式 patterns:
h?llo 匹配 hello, hallo 和 hxllo h*llo 匹配 hllo 和 heeeello h[ae]llo 匹配 hello 和 hallo, 不匹配 hillo h[^e]llo 匹配 hallo, hbllo, … 不匹配 hello h[a-b]llo 匹配 hallo 和 hbllo 使用 \ 转义你想匹配的特殊字符。
func KeysByPrefix ¶
func LInsertAfter ¶
func LInsertBefore ¶
func MDelByPrefix ¶
func Type ¶
Type > string hash list set 如果key不存在或者已过期,返回 -2*time.Nanosecond 如果key存在并且没有设置过期时间(永久有效),返回 -1*time.Nanosecond
func VersionHashName ¶
VersionHashName "%v_%v", hashName, "Version"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.