Version: v0.0.0-...-7c4d03a Latest Latest

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

Go to latest
Published: May 11, 2018 License: Apache-2.0 Imports: 9 Imported by: 0




View Source
const (
	// DefaultPagesize default pagesize
	DefaultPagesize = 500
	// DefaultMaxidle default maxidle
	DefaultMaxidle = 50
	// DefaultIdletimeout default idle timeout
	DefaultIdletimeout = 240 * time.Second
View Source
const (
	// RedisConfigNotExists redis readme
	RedisConfigNotExists = `redis config not exists,server=%s,master=%v`


This section is empty.


func GetRedisClient

func GetRedisClient(server string, isMaster bool) redis.Conn

GetRedisClient get redis client

func GetRedisPool

func GetRedisPool(addr, db string, maxIdle int, idleTimeout time.Duration) *redis.Pool

GetRedisPool get redis pool

func LoadRedisConfig

func LoadRedisConfig(filePath string) error

LoadRedisConfig load redis config


type Connect

type Connect struct {
	IP     string `yaml:"ip"`
	DB     string `yaml:"db"`
	Master bool   `yaml:"master"`

Connect connect

func GetRedisConn

func GetRedisConn(server string, isMaster bool) *Connect

GetRedisConn get redis connect

type RedisConfig

type RedisConfig struct {
	Name     string    `yaml:"name"`
	PoolSize int       `yaml:"poolSize"`
	TimeOut  int       `yaml:"timeOut"`
	Connects []Connect `yaml:"connect"`

RedisConfig redis config

type RedisLoads

type RedisLoads struct {
	RedisConf []*RedisConfig `yaml:"redisConfig"`

RedisLoads redis loads config

type RedisPool

type RedisPool struct {
	MaxIdle     int
	IdleTimeout time.Duration
	// contains filtered or unexported fields

RedisPool redis pool

func (*RedisPool) Get

func (p *RedisPool) Get(db string) (pool *redis.Pool)

Get get

type RedisStructure

type RedisStructure struct {
	KeyPrefixFormat string
	ServerName      string
	// contains filtered or unexported fields

RedisStructure redis structure

func NewRedisStructure

func NewRedisStructure(serverName, keyPrefixFormat string) RedisStructure

NewRedisStructure new redis structure

func (*RedisStructure) Bool

func (rs *RedisStructure) Bool(isMaster bool, cmd string, params ...interface{}) (reply bool, err error)

Bool bool

func (*RedisStructure) ByteSlices

func (rs *RedisStructure) ByteSlices(isMaster bool, cmd string, params ...interface{}) (reply [][]byte, err error)

ByteSlices byte slices

func (*RedisStructure) Bytes

func (rs *RedisStructure) Bytes(isMaster bool, cmd string, params ...interface{}) (reply []byte, err error)

Bytes bytes

func (*RedisStructure) DelKey

func (rs *RedisStructure) DelKey(keySuffix string) (bool, error)

DelKey delete key

func (*RedisStructure) Exists

func (rs *RedisStructure) Exists(key string) (bool, error)

Exists exists

func (*RedisStructure) Expire

func (rs *RedisStructure) Expire(keySuffix string, second int) (bool, error)

Expire expire

func (*RedisStructure) Float64

func (rs *RedisStructure) Float64(isMaster bool, cmd string, params ...interface{}) (reply float64, err error)

Float64 float64

func (*RedisStructure) InitPool

func (rs *RedisStructure) InitPool(connStr, db string)

InitPool init pool

func (*RedisStructure) InitRedisKey

func (rs *RedisStructure) InitRedisKey(keySuffix string) string

InitRedisKey init redis key

func (*RedisStructure) Int

func (rs *RedisStructure) Int(isMaster bool, cmd string, params ...interface{}) (reply int, err error)

Int int

func (*RedisStructure) Int64

func (rs *RedisStructure) Int64(isMaster bool, cmd string, params ...interface{}) (reply int64, err error)

Int64 int64

func (*RedisStructure) Int64Map

func (rs *RedisStructure) Int64Map(isMaster bool, cmd string, params ...interface{}) (reply map[string]int64, err error)

Int64Map int64 map

func (*RedisStructure) IntMap

func (rs *RedisStructure) IntMap(isMaster bool, cmd string, params ...interface{}) (reply map[string]int, err error)

IntMap int map

func (*RedisStructure) Ints

func (rs *RedisStructure) Ints(isMaster bool, cmd string, params ...interface{}) (reply []int, err error)

Ints ints

func (*RedisStructure) Keys

func (rs *RedisStructure) Keys(pattern string) ([]string, error)

Keys keys

func (*RedisStructure) MultiBulk

func (rs *RedisStructure) MultiBulk(isMaster bool, cmd string, params ...interface{}) (reply []interface{}, err error)

MultiBulk mulit bulk

func (*RedisStructure) MultiExec

func (rs *RedisStructure) MultiExec(isMaster bool, cmds [][]interface{}) ([]interface{}, error)

MultiExec Multi Exec

func (*RedisStructure) Ping

func (rs *RedisStructure) Ping(isMaster bool) (interface{}, error)

Ping ping

func (*RedisStructure) Rename

func (rs *RedisStructure) Rename(keySuffix, newKey string) (string, error)

Rename rename

func (*RedisStructure) String

func (rs *RedisStructure) String(isMaster bool, cmd string, params ...interface{}) (reply string, err error)

func (*RedisStructure) StringMap

func (rs *RedisStructure) StringMap(isMaster bool, cmd string, params ...interface{}) (reply map[string]string, err error)

StringMap string map

func (*RedisStructure) Strings

func (rs *RedisStructure) Strings(isMaster bool, cmd string, params ...interface{}) (reply []string, err error)

Strings strings

func (*RedisStructure) TTL

func (rs *RedisStructure) TTL(keySuffix string) (int, error)

TTL ttl

func (*RedisStructure) Uint64

func (rs *RedisStructure) Uint64(isMaster bool, cmd string, params ...interface{}) (reply uint64, err error)

Uint64 uint64

func (*RedisStructure) Values

func (rs *RedisStructure) Values(isMaster bool, cmd string, params ...interface{}) (reply []interface{}, err error)

Values values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL