goredisc

package
v1.2.265 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelClient

func DelClient(names ...string)

func Init

func Init(configs ...Config) (err error)

可以一次初始化多个Redis实例或者 多次调用初始化多个实例

Types

type ClusterConf

type ClusterConf Config

func (ClusterConf) GetCacheConf

func (c ClusterConf) GetCacheConf() cache.CacheConf

兼容go-zore

func (ClusterConf) GetConfig added in v1.2.215

func (c ClusterConf) GetConfig() Config

type Config

type Config struct {
	Name string `yaml:"Name" json:"name,optional"`
	//NamePrefix string `yaml:"NamePrefix" json:"namePrefix,optional"`
	Addrs        []string `yaml:"Addrs" json:"addrs,optional"`
	Password     string   `yaml:"Password" json:"password,optional"`
	DB           int      `yaml:"DB" json:"db,optional"`
	Prefix       string   `yaml:"Prefix" json:"prefix,optional"`
	AutoPing     bool     `yaml:"AutoPing" json:"autoPing,optional"`
	TLS          bool     `yaml:"TLS" json:"tls,optional"`
	DialTimeout  int      `yaml:"DialTimeout" json:"dialTimeout,optional"`
	ReadTimeout  int      `yaml:"ReadTimeout" json:"readTimeout,optional"`
	WriteTimeout int      `yaml:"WriteTimeout" json:"writeTimeout,optional"`
	MaxRedirects int      `yaml:"MaxRedirects" json:"maxRedirects,optional"`
	PoolSize     int      `yaml:"PoolSize" json:"poolSize,optional"`
	Type         string   `yaml:"Type" json:",default=node,options=node|cluster"`
	PingTimeout  int64    `yaml:"PingTimeout" json:"pingTimeout,optional"`
	Weight       int      `yaml:"Weight" json:",default=100"` //for gozero TODO: 这里需要有多个节点的配置
}

type GoRedisC

type GoRedisC struct {
	Redis  *redis.ClusterClient
	Config Config
	Ctx    context.Context
}

func Default

func Default() *GoRedisC

func GetClient

func GetClient(names ...string) *GoRedisC

func New

func New(conf Config) (cli *GoRedisC, err error)

func (*GoRedisC) BLPop

func (s *GoRedisC) BLPop(timeout time.Duration, key string) *redis.StringSliceCmd

Blpop uses passed in redis connection to execute blocking queries. Doesn't benefit from pooling redis connections of blocking queries

func (*GoRedisC) BitCount

func (s *GoRedisC) BitCount(key string, start, end int64) *redis.IntCmd

BitCount is redis bitcount command implementation.

func (*GoRedisC) BitOpAnd

func (s *GoRedisC) BitOpAnd(destKey string, keys ...string) *redis.IntCmd

BitOpAnd is redis bit operation (and) command implementation.

func (*GoRedisC) BitOpNot

func (s *GoRedisC) BitOpNot(destKey, key string) *redis.IntCmd

BitOpNot is redis bit operation (not) command implementation.

func (*GoRedisC) BitOpOr

func (s *GoRedisC) BitOpOr(destKey string, keys ...string) *redis.IntCmd

BitOpOr is redis bit operation (or) command implementation.

func (*GoRedisC) BitOpXor

func (s *GoRedisC) BitOpXor(destKey string, keys ...string) *redis.IntCmd

BitOpXor is redis bit operation (xor) command implementation.

func (*GoRedisC) BitPos

func (s *GoRedisC) BitPos(key string, bit, start, end int64) *redis.IntCmd

BitPos is redis bitpos command implementation.

func (*GoRedisC) Close added in v1.2.250

func (s *GoRedisC) Close() error

func (*GoRedisC) Del

func (s *GoRedisC) Del(keys ...string) *redis.IntCmd

Del deletes keys.

func (*GoRedisC) Eval

func (s *GoRedisC) Eval(script string, keys []string, args ...interface{}) *redis.Cmd

Eval is the implementation of redis eval command.

func (*GoRedisC) EvalSha

func (s *GoRedisC) EvalSha(sha string, keys []string, args ...interface{}) *redis.Cmd

EvalSha is the implementation of redis evalsha command.

func (*GoRedisC) Exists

func (s *GoRedisC) Exists(key string) *redis.IntCmd

Exists is the implementation of redis exists command.

func (*GoRedisC) Expire

func (s *GoRedisC) Expire(key string, seconds int) *redis.BoolCmd

Expire is the implementation of redis expire command.

func (*GoRedisC) ExpireAt

func (s *GoRedisC) ExpireAt(key string, time time.Time) *redis.BoolCmd

Expireat is the implementation of redis expireat command.

func (*GoRedisC) GeoAdd

func (s *GoRedisC) GeoAdd(key string, geoLocation ...*redis.GeoLocation) *redis.IntCmd

GeoAdd is the implementation of redis geoadd command.

func (*GoRedisC) GeoDist

func (s *GoRedisC) GeoDist(key, member1, member2, unit string) *redis.FloatCmd

GeoDist is the implementation of redis geodist command.

func (*GoRedisC) GeoHash

func (s *GoRedisC) GeoHash(key string, members ...string) *redis.StringSliceCmd

GeoHash is the implementation of redis geohash command.

func (*GoRedisC) GeoPos

func (s *GoRedisC) GeoPos(key string, members ...string) *redis.GeoPosCmd

GeoPos is the implementation of redis geopos command.

func (*GoRedisC) GeoRadius

func (s *GoRedisC) GeoRadius(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd

GeoRadius is the implementation of redis georadius command.

func (*GoRedisC) GeoRadiusByMember

func (s *GoRedisC) GeoRadiusByMember(key, member string, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd

GeoRadiusByMember is the implementation of redis georadiusbymember command.

func (*GoRedisC) Get

func (s *GoRedisC) Get(key string) *redis.StringCmd

Get is the implementation of redis get command.

func (*GoRedisC) GetBit

func (s *GoRedisC) GetBit(key string, offset int64) *redis.IntCmd

GetBit is the implementation of redis getbit command.

func (*GoRedisC) HDel

func (s *GoRedisC) HDel(key string, fields ...string) *redis.IntCmd

Hdel is the implementation of redis hdel command.

func (*GoRedisC) HExists

func (s *GoRedisC) HExists(key, field string) *redis.BoolCmd

Hexists is the implementation of redis hexists command.

func (*GoRedisC) HGet

func (s *GoRedisC) HGet(key, field string) *redis.StringCmd

Hget is the implementation of redis hget command.

func (*GoRedisC) HGetAll

func (s *GoRedisC) HGetAll(key string) *redis.MapStringStringCmd

Hgetall is the implementation of redis hgetall command.

func (*GoRedisC) HIncrBy

func (s *GoRedisC) HIncrBy(key, field string, increment int64) *redis.IntCmd

Hincrby is the implementation of redis hincrby command.

func (*GoRedisC) HKeys

func (s *GoRedisC) HKeys(key string) *redis.StringSliceCmd

Hkeys is the implementation of redis hkeys command.

func (*GoRedisC) HLen

func (s *GoRedisC) HLen(key string) *redis.IntCmd

Hlen is the implementation of redis hlen command.

func (*GoRedisC) HMGet

func (s *GoRedisC) HMGet(key string, fields ...string) *redis.SliceCmd

Hmget is the implementation of redis hmget command.

func (*GoRedisC) HMSet

func (s *GoRedisC) HMSet(key string, fieldsAndValues map[string]string) *redis.BoolCmd

Hmset is the implementation of redis hmset command.

func (*GoRedisC) HScan

func (s *GoRedisC) HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd

Hscan is the implementation of redis hscan command.

func (*GoRedisC) HSet

func (s *GoRedisC) HSet(key, field, value string) *redis.IntCmd

Hset is the implementation of redis hset command.

func (*GoRedisC) HSetNX

func (s *GoRedisC) HSetNX(key, field, value string) *redis.BoolCmd

Hsetnx is the implementation of redis hsetnx command.

func (*GoRedisC) HVals

func (s *GoRedisC) HVals(key string) *redis.StringSliceCmd

Hvals is the implementation of redis hvals command.

func (*GoRedisC) Incr

func (s *GoRedisC) Incr(key string) *redis.IntCmd

Incr is the implementation of redis incr command.

func (*GoRedisC) IncrBy

func (s *GoRedisC) IncrBy(key string, increment int64) *redis.IntCmd

Incrby is the implementation of redis incrby command.

func (*GoRedisC) Keys

func (s *GoRedisC) Keys(pattern string) *redis.StringSliceCmd

Keys is the implementation of redis keys command.

func (*GoRedisC) LLen

func (s *GoRedisC) LLen(key string) *redis.IntCmd

Llen is the implementation of redis llen command.

func (*GoRedisC) LPop

func (s *GoRedisC) LPop(key string) *redis.StringCmd

Lpop is the implementation of redis lpop command.

func (*GoRedisC) LPush

func (s *GoRedisC) LPush(key string, values ...interface{}) *redis.IntCmd

Lpush is the implementation of redis lpush command.

func (*GoRedisC) LRange

func (s *GoRedisC) LRange(key string, start, stop int64) *redis.StringSliceCmd

Lrange is the implementation of redis lrange command.

func (*GoRedisC) LRem

func (s *GoRedisC) LRem(key string, count int64, value string) *redis.IntCmd

Lrem is the implementation of redis lrem command.

func (*GoRedisC) MGet

func (s *GoRedisC) MGet(keys ...string) *redis.SliceCmd

Mget is the implementation of redis mget command.

func (*GoRedisC) PFAdd

func (s *GoRedisC) PFAdd(key string, values ...interface{}) *redis.IntCmd

Pfadd is the implementation of redis pfadd command.

func (*GoRedisC) PFCount

func (s *GoRedisC) PFCount(key string) *redis.IntCmd

Pfcount is the implementation of redis pfcount command.

func (*GoRedisC) PFMerge

func (s *GoRedisC) PFMerge(dest string, keys ...string) *redis.StatusCmd

Pfmerge is the implementation of redis pfmerge command.

func (*GoRedisC) Persist

func (s *GoRedisC) Persist(key string) *redis.BoolCmd

Persist is the implementation of redis persist command.

func (*GoRedisC) Ping

func (s *GoRedisC) Ping() *redis.StatusCmd

Ping is the implementation of redis ping command.

func (*GoRedisC) Pipelined

func (s *GoRedisC) Pipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)

Pipelined lets fn to execute pipelined commands. fn key must call GetKey or GetKeys to add prefix.

func (*GoRedisC) RPop

func (s *GoRedisC) RPop(key string) *redis.StringCmd

Rpop is the implementation of redis rpop command.

func (*GoRedisC) RPush

func (s *GoRedisC) RPush(key string, values ...interface{}) *redis.IntCmd

Rpush is the implementation of redis rpush command.

func (*GoRedisC) SAdd

func (s *GoRedisC) SAdd(key string, values ...interface{}) *redis.IntCmd

Sadd is the implementation of redis sadd command.

func (*GoRedisC) SCard

func (s *GoRedisC) SCard(key string) *redis.IntCmd

Scard is the implementation of redis scard command.

func (*GoRedisC) SDiff

func (s *GoRedisC) SDiff(keys ...string) *redis.StringSliceCmd

Sdiff is the implementation of redis sdiff command.

func (*GoRedisC) SDiffStore

func (s *GoRedisC) SDiffStore(destination string, keys ...string) *redis.IntCmd

Sdiffstore is the implementation of redis sdiffstore command.

func (*GoRedisC) SInter

func (s *GoRedisC) SInter(keys ...string) *redis.StringSliceCmd

Sinter is the implementation of redis sinter command.

func (*GoRedisC) SInterStore

func (s *GoRedisC) SInterStore(destination string, keys ...string) *redis.IntCmd

Sinterstore is the implementation of redis sinterstore command.

func (*GoRedisC) SIsMember

func (s *GoRedisC) SIsMember(key string, value interface{}) *redis.BoolCmd

Sismember is the implementation of redis sismember command.

func (*GoRedisC) SMembers

func (s *GoRedisC) SMembers(key string) *redis.StringSliceCmd

Smembers is the implementation of redis smembers command.

func (*GoRedisC) SPop

func (s *GoRedisC) SPop(key string) *redis.StringCmd

Spop is the implementation of redis spop command.

func (*GoRedisC) SRandMember

func (s *GoRedisC) SRandMember(key string) *redis.StringCmd

Srandmember is the implementation of redis srandmember command.

func (*GoRedisC) SRem

func (s *GoRedisC) SRem(key string, values ...interface{}) *redis.IntCmd

Srem is the implementation of redis srem command.

func (*GoRedisC) SScan

func (s *GoRedisC) SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd

Sscan is the implementation of redis sscan command.

func (*GoRedisC) SUnion

func (s *GoRedisC) SUnion(keys ...string) *redis.StringSliceCmd

Sunion is the implementation of redis sunion command.

func (*GoRedisC) SUnionStore

func (s *GoRedisC) SUnionStore(destination string, keys ...string) *redis.IntCmd

Sunionstore is the implementation of redis sunionstore command.

func (*GoRedisC) Scan

func (s *GoRedisC) Scan(cursor uint64, match string, count int64) *redis.ScanCmd

Scan is the implementation of redis scan command.

func (*GoRedisC) ScriptLoad

func (s *GoRedisC) ScriptLoad(script string) *redis.StringCmd

ScriptLoad is the implementation of redis script load command.

func (*GoRedisC) Set

func (s *GoRedisC) Set(key, value string) *redis.StatusCmd

Set is the implementation of redis set command.

func (*GoRedisC) Set1

func (s *GoRedisC) Set1(key, value string, expiration time.Duration) *redis.StatusCmd

func (*GoRedisC) SetBit

func (s *GoRedisC) SetBit(key string, offset int64, value int) *redis.IntCmd

SetBit is the implementation of redis setbit command.

func (*GoRedisC) SetEx

func (s *GoRedisC) SetEx(key, value string, expiration time.Duration) *redis.StatusCmd

Setex is the implementation of redis setex command.

func (*GoRedisC) SetNX

func (s *GoRedisC) SetNX(key, value string, expiration time.Duration) *redis.BoolCmd

func (*GoRedisC) TTL

func (s *GoRedisC) TTL(key string) *redis.DurationCmd

Ttl is the implementation of redis ttl command.

func (*GoRedisC) WrapKey

func (s *GoRedisC) WrapKey(key string) string

func (*GoRedisC) WrapKeys

func (s *GoRedisC) WrapKeys(keys ...string) []string

func (*GoRedisC) ZAdd

func (s *GoRedisC) ZAdd(key string, value ...redis.Z) *redis.IntCmd

Zadd is the implementation of redis zadd command.

func (*GoRedisC) ZCard

func (s *GoRedisC) ZCard(key string) *redis.IntCmd

Zcard is the implementation of redis zcard command.

func (*GoRedisC) ZCount

func (s *GoRedisC) ZCount(key string, max, min string) *redis.IntCmd

Zcount is the implementation of redis zcount command.

func (*GoRedisC) ZIncrBy

func (s *GoRedisC) ZIncrBy(key string, increment float64, field string) *redis.FloatCmd

Zincrby is the implementation of redis zincrby command.

func (*GoRedisC) ZRangeByScoreWithScores

func (s *GoRedisC) ZRangeByScoreWithScores(key string, opt *redis.ZRangeBy) *redis.ZSliceCmd

ZrangebyscoreWithScores is the implementation of redis zrangebyscore command with scores.

func (*GoRedisC) ZRangeWithScores

func (s *GoRedisC) ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd

ZrangeWithScores is the implementation of redis zrange command with scores.

func (*GoRedisC) ZRank

func (s *GoRedisC) ZRank(key, field string) *redis.IntCmd

Zrank is the implementation of redis zrank command.

func (*GoRedisC) ZRemRangeByScore

func (s *GoRedisC) ZRemRangeByScore(key string, max, min string) *redis.IntCmd

Zremrangebyscore is the implementation of redis zremrangebyscore command.

func (*GoRedisC) ZRevRangeByScoreWithScores

func (s *GoRedisC) ZRevRangeByScoreWithScores(key string, opt *redis.ZRangeBy) *redis.ZSliceCmd

ZrevrangebyscoreWithScores is the implementation of redis zrevrangebyscore command with scores.

func (*GoRedisC) ZRevRangeWithScores

func (s *GoRedisC) ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd

ZRevRangeWithScores is the implementation of redis zrevrange command with scores.

func (*GoRedisC) ZRevRank

func (s *GoRedisC) ZRevRank(key, field string) *redis.IntCmd

Zrevrank is the implementation of redis zrevrank command.

func (*GoRedisC) ZScore

func (s *GoRedisC) ZScore(key, value string) *redis.FloatCmd

Zscore is the implementation of redis zscore command.

func (*GoRedisC) ZUnionStore

func (s *GoRedisC) ZUnionStore(dest string, store *redis.ZStore) *redis.IntCmd

Zunionstore is the implementation of redis zunionstore command.

func (*GoRedisC) Zrange

func (s *GoRedisC) Zrange(key string, start, stop int64) *redis.StringSliceCmd

Zrange is the implementation of redis zrange command.

func (*GoRedisC) Zrem

func (s *GoRedisC) Zrem(key string, values ...interface{}) *redis.IntCmd

Zrem is the implementation of redis zrem command.

func (*GoRedisC) Zremrangebyrank

func (s *GoRedisC) Zremrangebyrank(key string, start, stop int64) *redis.IntCmd

Zremrangebyrank is the implementation of redis zremrangebyrank command.

func (*GoRedisC) Zrevrange

func (s *GoRedisC) Zrevrange(key string, start, stop int64) *redis.StringSliceCmd

Zrevrange is the implementation of redis zrevrange command.

Jump to

Keyboard shortcuts

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