redis

package
v0.0.0-...-6bcf8dd Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REDIS_CMD_SADD            = "SADD"
	REDIS_CMD_SCARD           = "SCARD"
	REDIS_CMD_SISMEMBER       = "SISMEMBER"
	REDIS_CMD_SMEMBERS        = "SMEMBERS"
	REDIS_CMD_SREM            = "SREM"
	REDIS_CMD_HSET            = "HSET"
	REDIS_CMD_HGET            = "HGET"
	REDIS_CMD_HMSET           = "HMSET"
	REDIS_CMD_HMGET           = "HMGET"
	REDIS_CMD_HDEL            = "HDEL"
	REDIS_CMD_HGETALL         = "HGETALL"
	REDIS_CMD_SET             = "SET"
	REDIS_CMD_SETNX           = "SETNX"
	REDIS_CMD_SETEX           = "SETEX"
	REDIS_CMD_GET             = "GET"
	REDIS_CMD_TTL             = "TTL"
	REDIS_CMD_STRLEN          = "STRLEN"
	REDIS_CMD_EXPIRE          = "EXPIRE"
	REDIS_CMD_DELETE          = "DEL"
	REDIS_CMD_KEYS            = "KEYS"
	REDIS_CMD_HKEYS           = "HKEYS"
	REDIS_CMD_EXISTS          = "EXISTS"
	REDIS_CMD_PERSIST         = "PERSIST"
	REDIS_CMD_ZADD            = "ZADD"
	REDIS_CMD_ZREM            = "ZREM"
	REDIS_CMD_ZRANGE          = "ZRANGE"
	REDIS_CMD_ZRANGE_BY_SCORE = "ZRANGEBYSCORE"
	REDIS_CMD_WITHSCORES      = "WITHSCORES"
	REDIS_CMD_INCR            = "INCR"
	REDIS_CMD_DECR            = "DECR"
	REDIS_CMD_INCRBY          = "INCRBY"
	REDIS_CMD_DECRBY          = "DECRBY"
	REDIS_CMD_INCRBYFLOAT     = "INCRBYFLOAT"
	REDIS_CMD_DECRBYFLOAT     = "DECRBYFLOAT"
	REDIS_CMD_PUBLISH         = "PUBLISH"
)

Variables

This section is empty.

Functions

func Decr

func Decr(RConn *redigo.Conn, key string) (int64, error)

func DecrBy

func DecrBy(RConn *redigo.Conn, key string, decrBy int64) (int64, error)

func DecrByFloat

func DecrByFloat(RConn *redigo.Conn, key string, decrBy float64) (float64, error)

func Delete

func Delete(RConn *redigo.Conn, key string) (interface{}, error)

func Exists

func Exists(RConn *redigo.Conn, key string) (bool, error)

func Expire

func Expire(RConn *redigo.Conn, key string, ttl int) (interface{}, error)

部分command实现

func Get

func Get(RConn *redigo.Conn, key string) (interface{}, error)

func GetInt

func GetInt(RConn *redigo.Conn, key string) (int, error)

func GetInt64

func GetInt64(RConn *redigo.Conn, key string) (int64, error)

func GetString

func GetString(RConn *redigo.Conn, key string) (string, error)

func GetStringLength

func GetStringLength(RConn *redigo.Conn, key string) (int, error)

func GetTTL

func GetTTL(RConn *redigo.Conn, key string) (time.Duration, error)

func GetUInt64

func GetUInt64(RConn *redigo.Conn, key string) (uint64, error)

func HDel

func HDel(RConn *redigo.Conn, key string, HKey string) (interface{}, error)

func HGet

func HGet(RConn *redigo.Conn, key string, HKey string) (interface{}, error)

func HGetAll

func HGetAll(RConn *redigo.Conn, key string) (interface{}, error)

func HGetAllString

func HGetAllString(RConn *redigo.Conn, key string) ([]string, error)

func HGetAllValues

func HGetAllValues(RConn *redigo.Conn, key string) ([]interface{}, error)

func HGetBool

func HGetBool(RConn *redigo.Conn, key string, HKey string) (bool, error)

func HGetFloat

func HGetFloat(RConn *redigo.Conn, key string, HKey string) (float64, error)

func HGetInt

func HGetInt(RConn *redigo.Conn, key string, HKey string) (int, error)

func HGetInt64

func HGetInt64(RConn *redigo.Conn, key string, HKey string) (int64, error)

func HGetString

func HGetString(RConn *redigo.Conn, key string, HKey string) (string, error)

func HKeys

func HKeys(RConn *redigo.Conn, key string) ([]string, error)

func HMGet

func HMGet(RConn *redigo.Conn, key string, hashKeys ...string) ([]interface{}, error)

func HMSet

func HMSet(RConn *redigo.Conn, key string, hashKeys []string, vals []interface{}) (interface{}, error)

func HSet

func HSet(RConn *redigo.Conn, key string, HKey string, data interface{}) (interface{}, error)

func Incr

func Incr(RConn *redigo.Conn, key string) (int64, error)

func IncrBy

func IncrBy(RConn *redigo.Conn, key string, incBy int64) (int64, error)

func IncrByFloat

func IncrByFloat(RConn *redigo.Conn, key string, incBy float64) (float64, error)

func Keys

func Keys(RConn *redigo.Conn, pattern string) ([]string, error)

func Persist

func Persist(RConn *redigo.Conn, key string) (interface{}, error)

func Publish

func Publish(RConn *redigo.Conn, key string, message interface{}) (int64, error)

func SAdd

func SAdd(RConn *redigo.Conn, setName string, data interface{}) (interface{}, error)

func SCard

func SCard(RConn *redigo.Conn, setName string) (int64, error)

func SIsMember

func SIsMember(RConn *redigo.Conn, setName string, data interface{}) (bool, error)

func SMembers

func SMembers(RConn *redigo.Conn, setName string) ([]string, error)

func SRem

func SRem(RConn *redigo.Conn, setName string, data interface{}) (interface{}, error)

func Set

func Set(RConn *redigo.Conn, key string, data interface{}) (interface{}, error)

func SetEx

func SetEx(RConn *redigo.Conn, key string, ttl int, data interface{}) (interface{}, error)

func SetNX

func SetNX(RConn *redigo.Conn, key string, data interface{}) (interface{}, error)

func ZAdd

func ZAdd(RConn *redigo.Conn, key string, score float64, data interface{}) (interface{}, error)

func ZRange

func ZRange(RConn *redigo.Conn, key string, start int, end int, withScores bool) ([]interface{}, error)

func ZRem

func ZRem(RConn *redigo.Conn, key string, data interface{}) (interface{}, error)

Types

type Component

type Component struct {
	component.DefaultComponent
}

func (*Component) Create

func (redisc *Component) Create(instConfig *component.ComponentInstConfig) (interface{}, error)

func (*Component) Update

func (redisc *Component) Update(inst interface{}, instConfig *component.ComponentInstConfig) error

type PoolConfig

type PoolConfig struct {
	Name              string
	Network           string
	Server            string
	ConnectionTimeout time.Duration
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
	Password          string
	DB                int
	MaxIdle           int
	MaxActive         int
	TestOnBorrow      bool
	IdleTimeout       time.Duration
	Wait              bool
}

type RPool

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

func NewPool

func NewPool(name string, configor pbconfig.Configor) (*RPool, error)

func (*RPool) Decr

func (rpool *RPool) Decr(key string) (int64, error)

func (*RPool) DecrBy

func (rpool *RPool) DecrBy(key string, decrBy int64) (int64, error)

func (*RPool) DecrByFloat

func (rpool *RPool) DecrByFloat(key string, decrBy float64) (float64, error)

func (*RPool) Delete

func (rpool *RPool) Delete(key string) (interface{}, error)

func (*RPool) Destroy

func (rpool *RPool) Destroy() error

func (*RPool) Do

func (rpool *RPool) Do(commandName string, args ...interface{}) (reply interface{}, err error)

command

func (*RPool) Exists

func (rpool *RPool) Exists(key string) (bool, error)

func (*RPool) Expire

func (rpool *RPool) Expire(key string, ttl int) (interface{}, error)

func (*RPool) Get

func (rpool *RPool) Get(key string) (interface{}, error)

func (*RPool) GetBytes

func (rpool *RPool) GetBytes(key string) ([]byte, error)

func (*RPool) GetConn

func (rpool *RPool) GetConn() redigo.Conn

func (*RPool) GetInt

func (rpool *RPool) GetInt(key string) (int, error)

func (*RPool) GetInt64

func (rpool *RPool) GetInt64(key string) (int64, error)

func (*RPool) GetString

func (rpool *RPool) GetString(key string) (string, error)

func (*RPool) GetTTL

func (rpool *RPool) GetTTL(key string) (time.Duration, error)

func (*RPool) GetUint64

func (rpool *RPool) GetUint64(key string) (uint64, error)

func (*RPool) HDel

func (rpool *RPool) HDel(key string, HKey string) (interface{}, error)

func (*RPool) HGet

func (rpool *RPool) HGet(key string, HKey string) (interface{}, error)

func (*RPool) HGetAll

func (rpool *RPool) HGetAll(key string) (interface{}, error)

func (*RPool) HGetAllString

func (rpool *RPool) HGetAllString(key string) ([]string, error)

func (*RPool) HGetAllValues

func (rpool *RPool) HGetAllValues(key string) ([]interface{}, error)

func (*RPool) HGetBool

func (rpool *RPool) HGetBool(key string, HKey string) (bool, error)

func (*RPool) HGetFloat

func (rpool *RPool) HGetFloat(key string, HKey string) (float64, error)

func (*RPool) HGetInt

func (rpool *RPool) HGetInt(key string, HKey string) (int, error)

func (*RPool) HGetInt64

func (rpool *RPool) HGetInt64(key string, HKey string) (int64, error)

func (*RPool) HGetString

func (rpool *RPool) HGetString(key string, HKey string) (string, error)

func (*RPool) HGetUint64

func (rpool *RPool) HGetUint64(key string, HKey string) (uint64, error)

func (*RPool) HKeys

func (rpool *RPool) HKeys(key string) ([]string, error)

func (*RPool) HMGet

func (rpool *RPool) HMGet(key string, hashKeys ...string) ([]interface{}, error)

func (*RPool) HMSet

func (rpool *RPool) HMSet(key string, hashKeys []string, vals []interface{}) (interface{}, error)

func (*RPool) HSet

func (rpool *RPool) HSet(key string, HKey string, data interface{}) (interface{}, error)

hash map

func (*RPool) Incr

func (rpool *RPool) Incr(key string) (int64, error)

func (*RPool) IncrBy

func (rpool *RPool) IncrBy(key string, incBy int64) (int64, error)

func (*RPool) IncrByFloat

func (rpool *RPool) IncrByFloat(key string, incBy float64) (float64, error)

func (*RPool) Keys

func (rpool *RPool) Keys(pattern string) ([]string, error)

func (*RPool) KeysByteSlices

func (rpool *RPool) KeysByteSlices(pattern string) ([][]byte, error)

func (*RPool) ParseConfig

func (rpool *RPool) ParseConfig(configor *pbconfig.Configor) PoolConfig

func (*RPool) Publish

func (rpool *RPool) Publish(key string, message interface{}) (int64, error)

func (*RPool) Set

func (rpool *RPool) Set(key string, data interface{}) (interface{}, error)

func (*RPool) UpdatePool

func (rpool *RPool) UpdatePool(config PoolConfig) (*RPool, error)

Jump to

Keyboard shortcuts

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