redis

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cluster

func Cluster() clientMode

func Sentinel

func Sentinel() clientMode

func Single

func Single() clientMode

Types

type Client

type Client interface {
	redis.Cmdable
}

type Config

type Config struct {
	Addrs    []string `yaml:"addrs"`
	Password string   `yaml:"password"`
	DB       int      `yaml:"db"`
	Master   string   `yaml:"master"`
}

type GeoLocation added in v1.0.12

type GeoLocation = redis.GeoLocation

type GeoPos added in v1.0.12

type GeoPos = redis.GeoPos

type GeoRadiusQuery added in v1.0.12

type GeoRadiusQuery = redis.GeoRadiusQuery

type Pair added in v1.0.12

type Pair struct {
	Key   string
	Score int64
}

type Pipeliner added in v1.0.14

type Pipeliner = redis.Pipeliner

type RedisConn

type RedisConn interface {
	Ping() (string, error)

	// Set args: 0->mode
	Set(key string, val interface{}, args ...int) error
	// SetNX args: 0->mode
	SetNX(key, val string, args ...int) (bool, error)
	Get(key string) (string, error)
	GetSet(key, val string) (string, error)
	Incr(key string) (int64, error)
	Incrby(key string, increment int64) (int64, error)
	IncrByFloat(key string, increment float64) (float64, error)
	Decr(key string) (int64, error)
	DecrBy(key string, decrement int64) (int64, error)
	MGet(keys ...string) ([]string, error)

	HSet(key, field, val string) error
	HSetNX(key, field, val string) (bool, error)
	HGet(key, field string) (string, error)
	HExists(key, field string) (bool, error)
	HDel(key string, fields ...string) (bool, error)
	HLen(key string) (int, error)
	HIncrBy(key, field string, increment int) (int, error)
	HIncrByFloat(key, field string, increment float64) (float64, error)
	HMset(key string, fieldsAndValues map[string]string) error
	HMget(key string, fields ...string) ([]string, error)
	HKeys(key string) ([]string, error)
	HVals(key string) ([]string, error)
	HGetAll(key string) (map[string]string, error)
	HScan(key string, cursor uint64, match string, count int64) ([]string, uint64, error)

	LPush(key string, values ...interface{}) (int, error)
	RPush(key string, values ...interface{}) (int, error)
	LPop(key string) (string, error)
	RPop(key string) (string, error)
	LRem(key string, count int, val string) (int, error)
	LLen(key string) (int, error)
	LIndex(key string, index int64) (string, error)
	LRange(key string, start, stop int64) ([]string, error)
	LTrim(key string, start, stop int64) error
	BLPop(node Client, key string) (string, error)

	SAdd(key string, values ...interface{}) (int, error)
	SIsMember(key string, val interface{}) (bool, error)
	SPop(key string) (string, error)
	SRandMember(key string, count int) ([]string, error)
	SRem(key string, values ...interface{}) (int, error)
	SCard(key string) (int64, error)
	SMembers(key string) ([]string, error)
	SScan(key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error)
	SInter(keys ...string) ([]string, error)
	SInterStore(destination string, keys ...string) (int, error)
	SUnion(keys ...string) ([]string, error)
	SUnionStore(destination string, keys ...string) (int, error)
	SDiff(keys ...string) ([]string, error)
	SDiffStore(destination string, keys ...string) (int, error)

	ZAdd(key string, score int64, val string) (bool, error)
	ZScore(key, val string) (int64, error)
	ZIncrBy(key string, increment int64, field string) (int64, error)
	ZCard(key string) (int, error)
	ZCount(key string, start, stop int64) (int, error)
	ZRange(key string, start, stop int64) ([]string, error)
	ZRevRangeWithScores(key string, start, stop int64) ([]Pair, error)
	ZRangeByScoreWithScores(key string, start, stop int64) ([]Pair, error)
	ZRevRangeByScoreWithScores(key string, start, stop int64) ([]Pair, error)
	ZRank(key, field string) (int64, error)
	ZRevRank(key, field string) (int64, error)
	ZRem(key string, values ...interface{}) (int, error)
	ZRemRangeByRank(key string, start, stop int64) (int, error)
	ZRemRangeByScore(key string, start, stop int64) (int, error)
	ZUnionStore(dest string, store *ZStore) (int64, error)

	GeoAdd(key string, geoLocation ...*GeoLocation) (int64, error)
	GeoPos(key string, members ...string) ([]*GeoPos, error)
	GeoDist(key, member1, member2, unit string) (float64, error)
	GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) ([]GeoLocation, error)
	GeoRadiusByMember(key, member string, query *GeoRadiusQuery) ([]GeoLocation, error)
	GeoHash(key string, members ...string) ([]string, error)

	SetBit(key string, offset int64, val int) (int, error)
	GetBit(key string, offset int64) (int, error)
	BitCount(key string, start, end int64) (int64, error)
	BitPos(key string, bit, start, end int64) (int64, error)
	BitOpAnd(destKey string, keys ...string) (int64, error)

	Exists(keys ...string) (bool, error)
	Del(keys ...string) error
	Scan(cursor uint64, match string, count int64) (keys []string, cur uint64, err error)

	Expire(key string, expiration time.Duration) error
	TTL(key string) (int, error)
	Persist(key string) (bool, error)

	Pipeline() Pipeliner
	Pipelined(fn func(Pipeliner) error) error
	TxPipeline() Pipeliner
	TxPipelined(fn func(Pipeliner) error) error

	Eval(script string, keys []string, args ...interface{}) (interface{}, error)
	EvalSha(sha string, keys []string, args ...interface{}) (interface{}, error)
	ScriptLoad(script string) (string, error)
}

func NewConn

func NewConn(conf Config, client clientMode) RedisConn

type Z added in v1.0.12

type Z = redis.Z

type ZStore added in v1.0.12

type ZStore = redis.ZStore

Jump to

Keyboard shortcuts

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