redis

package
v0.0.0-...-cd4d371 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(err error) bool

Types

type Cmd

type Cmd struct {
	Command string
	Args    []interface{}
}

func BRPop

func BRPop(timeout time.Duration, keys ...interface{}) Cmd

func BRPopLPush

func BRPopLPush(source, destination string, timeout time.Duration) Cmd

func Command

func Command(commandName string, args ...interface{}) Cmd

func Del

func Del(keys ...interface{}) Cmd

func Exists

func Exists(key string) Cmd

func Expire

func Expire(key string, expireIn time.Duration) Cmd

func ExpireAt

func ExpireAt(key string, expireAt time.Time) Cmd

func Get

func Get(key string) Cmd

func HDel

func HDel(key string, fields ...interface{}) Cmd

func HExists

func HExists(key, field string) Cmd

func HGet

func HGet(key, field string) Cmd

func HGetAll

func HGetAll(key string) Cmd

func HIncrBy

func HIncrBy(key, field string, increment int) Cmd

func HIncrByFloat

func HIncrByFloat(key, field string, increment float64) Cmd

func HKeys

func HKeys(key string) Cmd

func HLen

func HLen(key string) Cmd

func HMGet

func HMGet(key string, fields ...interface{}) Cmd

func HMSet

func HMSet(key string, values map[string]interface{}) Cmd

func HSet

func HSet(key, field string, value interface{}) Cmd

func HSetNX

func HSetNX(key, field string, value interface{}) Cmd

func HStrLen

func HStrLen(key, field string) Cmd

func HVals

func HVals(key string) Cmd

func LLen

func LLen(key string) Cmd

func LPush

func LPush(key string, values ...interface{}) Cmd

func LRange

func LRange(start, stop int) Cmd

func LRem

func LRem(key string, size int, val interface{}) Cmd

func Persist

func Persist(key string) Cmd

Persist 移除给定key的生存时间,将这个 key 从『易失的』(带生存时间 key )转换成『持久的』(一个不带生存时间、永不过期的 key )。 时间复杂度:O(1), 当生存时间移除成功时,返回 1 . 如果 key 不存在或 key 没有设置生存时间,返回 0 .

func RPop

func RPop(key string) Cmd

func RPopLPush

func RPopLPush(source, destination string) Cmd

func Set

func Set(key string, value interface{}, expireIn time.Duration) Cmd

func ZAdd

func ZAdd(key string, fieldValues map[string]float64, extra ...interface{}) Cmd

func ZRange

func ZRange(key string, start, end int, withScores bool) Cmd

func ZRangeByScore

func ZRangeByScore(key string, min, max float64) Cmd

func ZRem

func ZRem(key string, members ...interface{}) Cmd

func ZRemRangeByScore

func ZRemRangeByScore(key string, min, max float64) Cmd

type Config

type Config struct {
	Host     string `json:"host" toml:"host" yaml:"host"`
	Port     string `json:"port" toml:"port" yaml:"port"`
	Username string `json:"username" toml:"username" yaml:"username"`
	Password string `json:"password" toml:"password" yaml:"password"`
	DB       int    `json:"db" toml:"db" yaml:"db"`

	// Maximum number of idle connections in the p.
	MaxIdle int `json:"max_idle" toml:"max_idle" yaml:"max_idle"`

	// Maximum number of connections allocated by the p at a given time.
	// When zero, there is no limit on the number of connections in the p.
	MaxActive int `json:"max_active" toml:"max_active" yaml:"max_active"`

	// Close connections after remaining idle for this duration. If the value
	// is zero, then idle connections are not closed. Applications should set
	// the timeout to a value less than the server's timeout.
	IdleTimeout time.Duration `json:"idle_timeout" toml:"idle_timeout" yaml:"idle_timeout"`

	// If Wait is true and the p is at the MaxActive limit, then Get() waits
	// for a connection to be returned to the p before returning.
	Wait bool `json:"wait" toml:"wait"`

	// Close connections older than this duration. If the value is zero, then
	// the p does not close connections based on age.
	MaxConnLifetime time.Duration `json:"max_conn_lifetime" toml:"max_conn_lifetime" yaml:"max_conn_lifetime"`
	TLS             bool          `json:"tls" toml:"tls" yaml:"tls"`
}

func ParseDSN

func ParseDSN(dsn string) (o Config, err error)

ParseDSN parses an URL into Options that can be used to connect to redis.

func (*Config) Default

func (opt *Config) Default()

func (Config) Valid

func (opt Config) Valid() error

type PubSub

type PubSub = redis.PubSubConn

type Result

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

func (Result) Err

func (r Result) Err() error

func (Result) GetBool

func (r Result) GetBool() (bool, error)

func (Result) GetByteSlices

func (r Result) GetByteSlices() ([][]byte, error)

func (Result) GetBytes

func (r Result) GetBytes() ([]byte, error)

func (Result) GetFloat64

func (r Result) GetFloat64() (float64, error)

func (Result) GetFloat64s

func (r Result) GetFloat64s() ([]float64, error)

func (Result) GetInt

func (r Result) GetInt() (int, error)

func (Result) GetInt64

func (r Result) GetInt64() (int64, error)

func (Result) GetInt64Map

func (r Result) GetInt64Map() (map[string]int64, error)

func (Result) GetInt64s

func (r Result) GetInt64s() ([]int64, error)

func (Result) GetIntMap

func (r Result) GetIntMap() (map[string]int, error)

func (Result) GetInts

func (r Result) GetInts() ([]int, error)

func (Result) GetJSON

func (r Result) GetJSON(i interface{}) ([]byte, error)

func (Result) GetPositions

func (r Result) GetPositions() ([]*[2]float64, error)

func (Result) GetSlowLogs

func (r Result) GetSlowLogs() ([]SlowLog, error)

func (Result) GetString

func (r Result) GetString() (string, error)

func (Result) GetStringMap

func (r Result) GetStringMap() (map[string]string, error)

func (Result) GetStrings

func (r Result) GetStrings() ([]string, error)

func (Result) GetUint64

func (r Result) GetUint64() (uint64, error)

func (Result) GetUint64Map

func (r Result) GetUint64Map() (map[string]uint64, error)

func (Result) GetUint64s

func (r Result) GetUint64s() ([]uint64, error)

func (Result) GetValue

func (r Result) GetValue() (interface{}, error)

func (Result) GetValues

func (r Result) GetValues() ([]interface{}, error)

func (Result) Value

func (r Result) Value() interface{}

type Service

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

func New

func New() (*Service, error)

func (*Service) Do

func (s *Service) Do(ctx context.Context, cmd Cmd) Result

func (*Service) Multi

func (s *Service) Multi(ctx context.Context, cmds ...Cmd) Result

func (*Service) Ping

func (s *Service) Ping(ctx context.Context) (string, error)

func (*Service) Pipeline

func (s *Service) Pipeline(ctx context.Context, cmds ...Cmd) Result

func (*Service) PubSub

func (s *Service) PubSub(ctx context.Context) (PubSub, error)

func (*Service) StringGet

func (s *Service) StringGet(ctx context.Context, key string) (interface{}, error)

func (*Service) StringSet

func (s *Service) StringSet(ctx context.Context, key string, value interface{}, expireIn time.Duration) error

func (*Service) ZPopByScore

func (s *Service) ZPopByScore(ctx context.Context, key string, min, max float64) Result

type SlowLog

type SlowLog = redis.SlowLog

Jump to

Keyboard shortcuts

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