redis

package
v0.0.0-...-9d05754 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_POOL_SIZE  = 20
	MAX_IDLE_NUM   = 2
	MAX_ACTIVE_NUM = 20
	REDIS_ADDR     = "localhost:6379"
	REDISPASSWORD  = "180498"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DistLock

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

func NewDistLock

func NewDistLock(pool *RedisPool, key string, timeout int64) *DistLock

func (*DistLock) Lock

func (l *DistLock) Lock() error

func (*DistLock) Lock1

func (l *DistLock) Lock1() error

func (*DistLock) Unlock

func (l *DistLock) Unlock()

func (*DistLock) Unlock1

func (l *DistLock) Unlock1()

type Redis

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

func NewRedis

func NewRedis(pool *redis.Pool) (*Redis, error)

func (*Redis) Close

func (red *Redis) Close() error

func (*Redis) CreateListByInt64Slice

func (red *Redis) CreateListByInt64Slice(key string, data []int64) error

func (*Redis) DeleteKey

func (red *Redis) DeleteKey(key string) error

func (*Redis) Do

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

func (*Redis) Err

func (red *Redis) Err() error

func (*Redis) Flush

func (red *Redis) Flush() error

func (*Redis) GetInt64SliceList

func (red *Redis) GetInt64SliceList(key string) ([]int64, error)

func (*Redis) GetListLen

func (red *Redis) GetListLen(key string) (int, error)

func (*Redis) GetListValueByIndex

func (red *Redis) GetListValueByIndex(key string, index int) (int64, error)

func (*Redis) Hget

func (red *Redis) Hget(key, field string) (string, error)

func (*Redis) Hgetall

func (red *Redis) Hgetall(key string) (map[string]string, error)

func (*Redis) Hmget

func (red *Redis) Hmget(key string, fields []string) ([]string, error)

func (*Redis) Hmset

func (red *Redis) Hmset(key string, m map[string]interface{}) error

func (*Redis) Hset

func (red *Redis) Hset(key, field, value string) error

func (*Redis) HyperLogLogAdd

func (red *Redis) HyperLogLogAdd(key, value string) error

func (*Redis) HyperLogLogLen

func (red *Redis) HyperLogLogLen(key string) (int64, error)

func (*Redis) IsKeyExist

func (red *Redis) IsKeyExist(key string) bool

func (*Redis) ListPop

func (red *Redis) ListPop(key string) (string, error)

func (*Redis) ListPush

func (red *Redis) ListPush(key, value string) error

func (*Redis) Lock

func (red *Redis) Lock(key, value string, timeout int64) error

锁失败: 1.已上锁 2.网络问题

func (*Redis) Publish

func (red *Redis) Publish(channel, msg string) error

func (*Redis) Receive

func (red *Redis) Receive() (reply interface{}, err error)

func (*Redis) Send

func (red *Redis) Send(commandName string, args ...interface{}) error

func (*Redis) SetAdd

func (red *Redis) SetAdd(key, value string) error

func (*Redis) SetLen

func (red *Redis) SetLen(key string) (int64, error)

func (*Redis) SetListValueByIndex

func (red *Redis) SetListValueByIndex(key string, index int, value int64) error

func (*Redis) SetMembers

func (red *Redis) SetMembers(key string) ([]string, error)

func (*Redis) Unlock

func (red *Redis) Unlock(key, value string) error

func (*Redis) ZsetAdd

func (red *Redis) ZsetAdd(key, value string, score int64) error

func (*Redis) ZsetLen

func (red *Redis) ZsetLen(key string) (int64, error)

func (*Redis) ZsetLenBetweenScores

func (red *Redis) ZsetLenBetweenScores(key string, min, max int64) (int64, error)

func (*Redis) ZsetMembers

func (red *Redis) ZsetMembers(key string) (map[string]int64, error)

type RedisPool

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

func NewRedisPool

func NewRedisPool(addr, pw string) (*RedisPool, error)

func (*RedisPool) Get

func (rp *RedisPool) Get() (*Redis, error)

Jump to

Keyboard shortcuts

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