redis

package
v0.0.0-...-26e1b9e Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func GetClient

func GetClient() *Client

func NewClient

func NewClient(config *Config) *Client

func (*Client) Close

func (c *Client) Close() (err error)

func (*Client) Decr

func (c *Client) Decr(key string) bool

func (*Client) Del

func (c *Client) Del(key string) int64

func (*Client) DelWithErr

func (c *Client) DelWithErr(key string) (int64, error)

func (*Client) Exists

func (c *Client) Exists(key string) bool

func (*Client) ExistsWithErr

func (c *Client) ExistsWithErr(key string) (bool, error)

func (*Client) Expire

func (c *Client) Expire(key string, expiration time.Duration) (bool, error)

Expire 设置过期时间

func (*Client) GeoAdd

func (c *Client) GeoAdd(key string, location *redis.GeoLocation) (int64, error)

func (*Client) GeoRadius

func (c *Client) GeoRadius(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) ([]redis.GeoLocation, error)

func (*Client) Get

func (c *Client) Get(key string) string

func (*Client) GetRaw

func (c *Client) GetRaw(key string) ([]byte, error)

func (*Client) HDel

func (c *Client) HDel(key string, field ...string) bool

func (*Client) HGet

func (c *Client) HGet(key string, fields string) (string, error)

func (*Client) HGetAll

func (c *Client) HGetAll(key string) map[string]string

func (*Client) HIncrBy

func (c *Client) HIncrBy(key string, field string, incr int)

func (*Client) HKeys

func (c *Client) HKeys(key string) []string

func (*Client) HLen

func (c *Client) HLen(key string) int64

func (*Client) HMGet

func (c *Client) HMGet(key string, fileds []string) []string

func (*Client) HMGetMap

func (c *Client) HMGetMap(key string, fields []string) map[string]string

func (*Client) HMSet

func (c *Client) HMSet(key string, hash map[string]interface{}, expire time.Duration) bool

func (*Client) HSet

func (c *Client) HSet(key string, field string, value interface{}) bool

func (*Client) Incr

func (c *Client) Incr(key string) bool

func (*Client) IncrBy

func (c *Client) IncrBy(key string, increment int64) (int64, error)

func (*Client) IncrWithErr

func (c *Client) IncrWithErr(key string) (int64, error)

func (*Client) LIndex

func (c *Client) LIndex(key string, idx int64) (string, error)

func (*Client) LLen

func (c *Client) LLen(key string) int64

func (*Client) LLenWithErr

func (c *Client) LLenWithErr(key string) (int64, error)

func (*Client) LPush

func (c *Client) LPush(key string, values ...interface{}) (int64, error)

func (*Client) LRange

func (c *Client) LRange(key string, start, stop int64) ([]string, error)

func (*Client) LRem

func (c *Client) LRem(key string, count int64, value interface{}) int64

func (*Client) LTrim

func (c *Client) LTrim(key string, start, stop int64) (string, error)

func (*Client) MGet

func (c *Client) MGet(keys ...string) ([]string, error)

func (*Client) MGets

func (c *Client) MGets(keys []string) ([]interface{}, error)

func (*Client) RPop

func (c *Client) RPop(key string) (string, error)

func (*Client) RPush

func (c *Client) RPush(key string, values ...interface{}) (int64, error)

func (*Client) SAdd

func (c *Client) SAdd(key string, member ...interface{}) (int64, error)

func (*Client) SIsMember

func (c *Client) SIsMember(key string, member interface{}) (bool, error)

func (*Client) SMembers

func (c *Client) SMembers(key string) ([]string, error)

func (*Client) Set

func (c *Client) Set(key string, value interface{}, expire time.Duration) bool

func (*Client) SetNx

func (c *Client) SetNx(key string, value interface{}, expiration time.Duration) bool

func (*Client) SetNxWithErr

func (c *Client) SetNxWithErr(key string, value interface{}, expiration time.Duration) (bool, error)

func (*Client) SetWithErr

func (c *Client) SetWithErr(key string, value interface{}, expire time.Duration) error

func (*Client) Type

func (c *Client) Type(key string) (string, error)

func (*Client) WithContext

func (c *Client) WithContext(ctx context.Context) *Client

func (*Client) ZAdd

func (c *Client) ZAdd(key string, members ...redis.Z) (int64, error)

func (*Client) ZCard

func (c *Client) ZCard(key string) (int64, error)

func (*Client) ZCount

func (c *Client) ZCount(key string, min, max string) (int64, error)

func (*Client) ZRange

func (c *Client) ZRange(key string, start, stop int64) ([]string, error)

func (*Client) ZRem

func (c *Client) ZRem(key string, members ...interface{}) (int64, error)

func (*Client) ZRemRangeByRank

func (c *Client) ZRemRangeByRank(key string, start, stop int64) (int64, error)

func (*Client) ZRevRange

func (c *Client) ZRevRange(key string, start, stop int64) ([]string, error)

func (*Client) ZRevRangeByScore

func (c *Client) ZRevRangeByScore(key string, opt redis.ZRangeBy) ([]string, error)

func (*Client) ZRevRangeByScoreWithScores

func (c *Client) ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) ([]redis.Z, error)

func (*Client) ZRevRangeWithScores

func (c *Client) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)

func (*Client) ZRevRank

func (c *Client) ZRevRank(key string, member string) (int64, error)

func (*Client) ZScore

func (c *Client) ZScore(key string, member string) (float64, error)

type Config

type Config struct {
	Address       string        `json:"address" yaml:"address"`             //redis地址
	DB            int           `json:"db" yaml:"db"`                       //redis逻辑数据库
	PoolSize      int           `json:"poolSize" yaml:"poolSize"`           //redis连接池
	MaxRetries    int           `json:"maxRetries"  yaml:"maxRetries" `     //redis最大重试数目
	MinIdleConns  int           `json:"minIdleConns" yaml:"minIdleConns"`   //最小空闲数
	Password      string        `json:"password" yaml:"password"`           //密码
	DialTimeout   time.Duration `json:"dialTimeout" yaml:"dialTimeout"`     //连接超时 单位:秒
	IdleTimeout   time.Duration `json:"idleTimeout" yaml:"idleTimeout"`     //空闲超时 单位:秒
	ReadTimeout   time.Duration `json:"readTimeout" yaml:"readTimeout"`     //读取超时 单位:秒
	WriteTimeout  time.Duration `json:"writeTimeout" yaml:"writeTimeout"`   //写超时 单位:秒
	Debug         bool          `json:"debug" yaml:"debug"`                 //是否打印调试日志
	DisableMetric bool          `json:"disableMetric" yaml:"disableMetric"` //是否进行监控
	DisableTrace  bool          `json:"disableTrace" yaml:"disableTrace"`   //是否进行链路追踪
	SlowThreshold time.Duration `json:"slowThreshold" yaml:"slowThreshold"` //慢日志阈值 单位:毫秒
}

func DefaultConfig

func DefaultConfig() Config

Jump to

Keyboard shortcuts

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