redis

package
v0.0.0-...-d35fdca Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REDIS_UNIQUE_ID_KEY = "REDIS_UNIQUE_ID_KEY"
)

Variables

This section is empty.

Functions

func LoadClient

func LoadClient(conf utils.RedisConf) error

Types

type RedisClient

type RedisClient struct {
	Config utils.RedisConf
	// contains filtered or unexported fields
}

一般我们在一个系统里面使用redis 所以该Client下的基本命令都会自动追加Prefix

var MainClient *RedisClient

func (*RedisClient) Conn

func (c *RedisClient) Conn() (redis.Conn, error)

func (*RedisClient) Csadd

func (c *RedisClient) Csadd(key string, members ...interface{}) (added bool, err error)

SADD

func (*RedisClient) Csismember

func (c *RedisClient) Csismember(key string, item interface{}) (ok bool, err error)

SISMEMBER

func (*RedisClient) Csmembers

func (c *RedisClient) Csmembers(key string, out interface{}) (err error)

SMEMBERS

func (*RedisClient) Del

func (c *RedisClient) Del(key string) (interface{}, error)

func (*RedisClient) Do

func (c *RedisClient) Do(commandName string, args ...interface{}) (interface{}, error)

func (*RedisClient) Expire

func (c *RedisClient) Expire(key string, second int) (err error)

EXPIRE

func (*RedisClient) FullKey

func (c *RedisClient) FullKey(key string) string

获取附带Prefix的完整key

func (*RedisClient) Get

func (c *RedisClient) Get(key string) (interface{}, error)

func (*RedisClient) GetBytes

func (c *RedisClient) GetBytes(key string, def []byte) ([]byte, error)

func (*RedisClient) GetGlob

func (c *RedisClient) GetGlob(key string, out interface{}) error

func (*RedisClient) GetInt

func (c *RedisClient) GetInt(key string, def int) (int, error)

func (*RedisClient) GetInt64

func (c *RedisClient) GetInt64(key string, def int64) (int64, error)

func (*RedisClient) Incr

func (c *RedisClient) Incr(key string) (int64, error)

func (*RedisClient) IncrBy

func (c *RedisClient) IncrBy(key string, increment int) (int64, error)

func (*RedisClient) Set

func (c *RedisClient) Set(key string, value interface{}, opts ...interface{}) (interface{}, error)

https://redis.io/commands/set

func (*RedisClient) SetGlob

func (c *RedisClient) SetGlob(key string, ptr interface{}) error

gob.Register

type RedisMutex

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

func NewRedisMutex

func NewRedisMutex(name string, timeout int) *RedisMutex

简陋redis锁 name: 锁的key timeout: 过期秒数

func (*RedisMutex) Lock

func (m *RedisMutex) Lock() bool

func (*RedisMutex) Unlock

func (m *RedisMutex) Unlock()

Jump to

Keyboard shortcuts

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