redis

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	REDIS_UNKNOWN_CLIENT = iota
	REDIS_NORMAL_CLIENT
	REDIS_CLUSTER_CLIENT
	REDIS_SENTINEL_CLIENT
)
View Source
const ERR_NOT_INIT_MSG = "redis client is not initialized yet."
View Source
const InvalidQueueName = "InvalidQueue"

Variables

View Source
var DataTables = []RedisDatabase{FileTable}

Functions

func Close

func Close()

func Get

func Get(table RedisDatabase, prefix, key string) (value interface{}, err error)

func GetBytes

func GetBytes(key string, start int64, end int64) ([]byte, error)

Get file bytes `start` and `end` are inclusive FIXME: this API causes an extra memory copy, need to patch radix to fix it

func HDel

func HDel(table RedisDatabase, prefix, key string, fields []string) (int64, error)

func HGet

func HGet(table RedisDatabase, prefix, key, field string) (string, error)

func HGetAll

func HGetAll(table RedisDatabase, prefix, key string) (map[string]string, error)

func HGetInt64

func HGetInt64(table RedisDatabase, prefix, key, field string) (int64, error)

func HIncrBy

func HIncrBy(table RedisDatabase, prefix, key, field string, incr int64) (int64, error)

func HMGet

func HMGet(table RedisDatabase, prefix, key string, fields []string) (map[string]interface{}, error)

func HMSet

func HMSet(table RedisDatabase, prefix, key string, fields map[string]interface{}) (string, error)

func HSet

func HSet(table RedisDatabase, prefix, key, field string, value interface{}) (bool, error)

func HasRedisClient

func HasRedisClient() bool

func IncrBy

func IncrBy(table RedisDatabase, prefix, key string, value int64) (int64, error)

func Initialize

func Initialize(cfg *config.CacheConfig)

func Invalid

func Invalid(table RedisDatabase, key string) (err error)

Publish the invalid message to other YIG instances through Redis

func Keys

func Keys(table RedisDatabase, pattern string) ([]string, error)

don't use the escapecolon in keys command.

func MGet

func MGet(table RedisDatabase, prefix string, keys []string) ([]interface{}, error)

func MSet

func MSet(table RedisDatabase, prefix string, pairs map[string]interface{}) (string, error)

func Remove

func Remove(table RedisDatabase, prefix, key string) (err error)

func Set

func Set(table RedisDatabase, prefix, key string, value interface{}) (err error)

func SetBytes

func SetBytes(key string, value []byte) (err error)

Set file bytes

Types

type RedisCli

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

func GetClient

func GetClient() (*RedisCli, error)

func NewRedisCli

func NewRedisCli() *RedisCli

func (*RedisCli) Close

func (cli *RedisCli) Close() error

func (*RedisCli) Del

func (cli *RedisCli) Del(key string) (int64, error)

func (*RedisCli) Expire

func (cli *RedisCli) Expire(key string, expire int64) (bool, error)

func (*RedisCli) Get

func (cli *RedisCli) Get(key string) (val []byte, err error)

func (*RedisCli) GetRange

func (cli *RedisCli) GetRange(key string, start, end int64) (val []byte, err error)

func (*RedisCli) HDel

func (cli *RedisCli) HDel(key string, fields []string) (val int64, err error)

func (*RedisCli) HGet

func (cli *RedisCli) HGet(key, field string) (val string, err error)

func (*RedisCli) HGetAll

func (cli *RedisCli) HGetAll(key string) (val map[string]string, err error)

func (*RedisCli) HGetInt64

func (cli *RedisCli) HGetInt64(key, field string) (val int64, err error)

func (*RedisCli) HIncrBy

func (cli *RedisCli) HIncrBy(key, field string, incr int64) (int64, error)

func (*RedisCli) HMGet

func (cli *RedisCli) HMGet(key string, fields []string) (map[string]interface{}, error)

func (*RedisCli) HMSet

func (cli *RedisCli) HMSet(key string, fields map[string]interface{}) (string, error)

func (*RedisCli) HSet

func (cli *RedisCli) HSet(key, field string, value interface{}) (bool, error)

func (*RedisCli) IncrBy

func (cli *RedisCli) IncrBy(key string, value int64) (int64, error)

func (*RedisCli) Init

func (cli *RedisCli) Init(cfg *config.CacheConfig)

func (*RedisCli) IsValid

func (cli *RedisCli) IsValid() bool

func (*RedisCli) Keys

func (cli *RedisCli) Keys(pattern string) ([]string, error)

func (*RedisCli) MGet

func (cli *RedisCli) MGet(keys []string) ([]interface{}, error)

func (*RedisCli) MSet

func (cli *RedisCli) MSet(pairs map[interface{}]interface{}) (string, error)

func (*RedisCli) Ping

func (cli *RedisCli) Ping() (string, error)

func (*RedisCli) Publish

func (cli *RedisCli) Publish(channel string, message interface{}) (int64, error)

func (*RedisCli) Set

func (cli *RedisCli) Set(key string, value interface{}, expire int64) (string, error)

type RedisDatabase

type RedisDatabase int
const (
	UserTable RedisDatabase = iota
	BucketTable
	ObjectTable
	FileTable
	ClusterTable
)

func (RedisDatabase) InvalidQueue

func (r RedisDatabase) InvalidQueue() string

func (RedisDatabase) String

func (r RedisDatabase) String() string

Jump to

Keyboard shortcuts

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