Documentation
¶
Index ¶
- type Options
- type RedisClient
- func (r *RedisClient) Close()
- func (r *RedisClient) Decr(key string) int64
- func (r *RedisClient) Del(keys ...string) int64
- func (r *RedisClient) Expire(key string, expiration time.Duration) bool
- func (r *RedisClient) Get(key string) string
- func (r *RedisClient) HDel(key string, hashKey ...string) int64
- func (r *RedisClient) HGet(key string, hashKey string) string
- func (r *RedisClient) HGetAll(key string) map[string]string
- func (r *RedisClient) HIncrBy(key string, hashKey string, delta int64) int64
- func (r *RedisClient) HMGet(key string, hashKey ...string) map[string]interface{}
- func (r *RedisClient) HMSet(key string, vals map[string]string) bool
- func (r *RedisClient) HSet(key string, hashKey string, val string) int64
- func (r *RedisClient) HashKey(key string) bool
- func (r *RedisClient) Incr(key string) int64
- func (r *RedisClient) IncrByTime(key string, expiration time.Duration) int64
- func (r *RedisClient) LPop(key string, member ...string) string
- func (r *RedisClient) LPush(key string, valus ...interface{}) int64
- func (r *RedisClient) Ping() error
- func (r *RedisClient) SAdd(key string, member ...interface{}) int64
- func (r *RedisClient) SIsMember(key string, member string) bool
- func (r *RedisClient) SMembers(key string) []string
- func (r *RedisClient) SRemove(key string, member string) int64
- func (r *RedisClient) Set(key string, value string, expiration time.Duration)
- func (r *RedisClient) SetNX(key string, value string, expiration time.Duration) bool
- func (r *RedisClient) Size() int64
- func (r *RedisClient) Ttl(key string) time.Duration
- func (r *RedisClient) ZAdd(key string, member string, score float64) int64
- func (r *RedisClient) ZIncrBy(key string, member string, score float64) float64
- func (r *RedisClient) ZScore(key string, member string) float64
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) 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) 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) 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) SMembers ¶
func (r *RedisClient) SMembers(key string) []string
func (*RedisClient) Set ¶
func (r *RedisClient) Set(key string, value string, expiration time.Duration)
func (*RedisClient) Size ¶
func (r *RedisClient) Size() int64
func (*RedisClient) ZAdd ¶
func (r *RedisClient) ZAdd(key string, member string, score float64) int64
Click to show internal directories.
Click to hide internal directories.