cache

package
v0.0.0-...-b009ced Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decr

func Decr(k string) (int64, error)

func Del

func Del(k string) error

删除一个键

func DelNP

func DelNP(k string) error

del一个键

func Do

func Do(cmd string, args ...interface{}) (interface{}, error)

执行redis命令

func Expire

func Expire(k string, t time.Duration) error

设置过期时间

func GetBool

func GetBool(k string) (bool, error)

func GetBytes

func GetBytes(k string) ([]byte, error)

func GetInt

func GetInt(k string) (int, error)

func GetInt64

func GetInt64(k string) (int64, error)

func GetIntNP

func GetIntNP(k string) (int, error)

****************************no prefix**************************** get int no prefix

func GetPrefixName

func GetPrefixName() string

func GetString

func GetString(k string) (string, error)

func HDel

func HDel(rank, field string) error

func HExistsField

func HExistsField(rank, field string) bool

func HGet

func HGet(rank, field string, v interface{}) error

func HGetAllInt

func HGetAllInt(rank string) (map[string]int, error)

func HGetInt

func HGetInt(rank, field string) (int, error)

func HSet

func HSet(rank string, field string, v interface{}) (err error)

func HSetInt

func HSetInt(rank, field string, value int) error

func Incr

func Incr(k string) (int64, error)

增减

func InitRedisPool

func InitRedisPool(rcnf *Redis)

创建redis 连接池

func IsExist

func IsExist(key string) bool

检测键是否存在

func LPush

func LPush(k string, v ...interface{}) (int64, error)

func Publish

func Publish(channel string, msg interface{}) error

发布

func RedisPool

func RedisPool() *redis.Pool

func SAdd

func SAdd(k string, v ...interface{}) (int64, error)

****************************SET****************************

func SCard

func SCard(k string) (int64, error)

查看set元素数量

func SRem

func SRem(k string, v ...interface{}) (int64, error)

func Set

func Set(k string, v interface{}) error

默认十分钟过期时间

func SetEX

func SetEX(k string, t time.Duration, v interface{}) error

func SetEXNP

func SetEXNP(k string, t time.Duration, v interface{}) error

set with ex, no prefix

func SetNE

func SetNE(k string, v interface{}) error

永不过期

func SetNX

func SetNX(k string, v interface{}) error

func SetPrefixName

func SetPrefixName(name string)

func ZAdd

func ZAdd(rank string, k string, s int64) (int64, error)

插入或更新元素

func ZIncrBy

func ZIncrBy(rank string, k string, s int64) (int64, error)

func ZRange

func ZRange(rank string, start, stop int) ([]string, error)

func ZRank

func ZRank(rank string, k string) (int, error)

func ZRem

func ZRem(rank string, k string) error

删除元素

func ZRemRangeByRank

func ZRemRangeByRank(rank string, start, stop int64) (int, error)

func ZRemRangeByScore

func ZRemRangeByScore(rank string, start, stop int64) (int, error)

func ZRevRange

func ZRevRange(rank string, start, stop int) ([]string, error)

func ZRevRank

func ZRevRank(rank string, k string) (int, error)

func ZSCORE

func ZSCORE(rank string, k string) (int64, error)

Types

type Redis

type Redis struct {
	Host string `json:"host"`
	DB   string `json:"db,omitempty"`
	Auth string `json:"auth,omitempty"`
}

Redis

type ZRankItem

type ZRankItem struct {
	Key   string
	Score int64
}

func ZRangeWithScores

func ZRangeWithScores(rank string, start, stop int) ([]ZRankItem, error)

TODO: 转map会有乱序的问题,暂时先用转list的方式代替

func ZRevRangeWithScores

func ZRevRangeWithScores(rank string, start, stop int) ([]ZRankItem, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL