redis

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Either a single address or a seed list of host:port addresses
	// of cluster/sentinel nodes.
	Addrs []string `property:"redis.addrs"`

	// Database to be selected after connecting to the server.
	// Only single-node and failover clients.
	DB int `property:"redis.db"`

	Dialer    func(ctx context.Context, network, addr string) (net.Conn, error)
	OnConnect func(ctx context.Context, cn *redis.Conn) error

	Username         string `property:"redis.username"`
	Password         string `property:"redis.password"`
	SentinelPassword string `property:"redis.sentinel.password"`

	MaxRetries      int           `property:"redis.maxRetries"`
	MinRetryBackoff time.Duration `property:"redis.minRetryBackoff"`
	MaxRetryBackoff time.Duration `property:"redis.maxRetryBackoff"`

	DialTimeout  time.Duration `property:"redis.dialTimeout"`
	ReadTimeout  time.Duration `property:"redis.readTimeout"`
	WriteTimeout time.Duration `property:"redis.writeTimeout"`

	PoolSize           int           `property:"redis.poolSize"`
	MinIdleConns       int           `property:"redis.minIdleConns"`
	MaxConnAge         time.Duration `property:"redis.maxConnAge"`
	PoolTimeout        time.Duration `property:"redis.poolTimeout"`
	IdleTimeout        time.Duration `property:"redis.idleTimeout"`
	IdleCheckFrequency time.Duration `property:"redis.idleCheckFrequency"`

	TLSConfig *tls.Config

	MaxRedirects   int  `property:"redis.maxRedirects"`
	ReadOnly       bool `property:"redis.readOnly"`
	RouteByLatency bool `property:"redis.routeByLatency"`
	RouteRandomly  bool `property:"redis.routeRandomly"`

	MasterName string `property:"redis.masterName"`
}

type RedisClient

type RedisClient struct {
	// contains filtered or unexported fields
}

func GetClient

func GetClient() *RedisClient

func NewClient

func NewClient(opts Options) *RedisClient

func (*RedisClient) Close

func (r *RedisClient) Close()

func (*RedisClient) Decr

func (r *RedisClient) Decr(key string) int64

func (*RedisClient) Del

func (r *RedisClient) Del(keys ...string) int64

func (*RedisClient) Expire

func (r *RedisClient) Expire(key string, expiration time.Duration) bool

func (*RedisClient) Get

func (r *RedisClient) Get(key string) string

func (*RedisClient) HDel

func (r *RedisClient) HDel(key string, hashKey ...string) int64

func (*RedisClient) HGet

func (r *RedisClient) HGet(key string, hashKey string) string

func (*RedisClient) HGetAll

func (r *RedisClient) HGetAll(key string) map[string]string

func (*RedisClient) HIncrBy

func (r *RedisClient) HIncrBy(key string, hashKey string, delta int64) int64

func (*RedisClient) HMGet

func (r *RedisClient) HMGet(key string, hashKey ...string) map[string]interface{}

func (*RedisClient) HMSet

func (r *RedisClient) HMSet(key string, vals map[string]string) bool

func (*RedisClient) HSet

func (r *RedisClient) HSet(key string, hashKey string, val string) int64

func (*RedisClient) HashKey

func (r *RedisClient) HashKey(key string) bool

func (*RedisClient) Incr

func (r *RedisClient) Incr(key string) int64

func (*RedisClient) IncrByTime

func (r *RedisClient) IncrByTime(key string, expiration time.Duration) int64

func (*RedisClient) LPop

func (r *RedisClient) LPop(key string, member ...string) string

func (*RedisClient) LPush

func (r *RedisClient) LPush(key string, valus ...interface{}) int64

func (*RedisClient) Ping

func (r *RedisClient) Ping() error

func (*RedisClient) SAdd

func (r *RedisClient) SAdd(key string, member ...interface{}) int64

func (*RedisClient) SIsMember

func (r *RedisClient) SIsMember(key string, member string) bool

func (*RedisClient) SMembers

func (r *RedisClient) SMembers(key string) []string

func (*RedisClient) SRemove

func (r *RedisClient) SRemove(key string, member string) int64

func (*RedisClient) Set

func (r *RedisClient) Set(key string, value string, expiration time.Duration)

func (*RedisClient) SetNX

func (r *RedisClient) SetNX(key string, value string, expiration time.Duration) bool

func (*RedisClient) Size

func (r *RedisClient) Size() int64

func (*RedisClient) Ttl

func (r *RedisClient) Ttl(key string) time.Duration

func (*RedisClient) ZAdd

func (r *RedisClient) ZAdd(key string, member string, score float64) int64

func (*RedisClient) ZIncrBy

func (r *RedisClient) ZIncrBy(key string, member string, score float64) float64

func (*RedisClient) ZScore

func (r *RedisClient) ZScore(key string, member string) float64

Jump to

Keyboard shortcuts

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