Documentation
¶
Overview ¶
redis相关的功能 1. 初始化 Init(redisCfg *RedisConfigST) error 2. 使用接口 Get(key string) (reply interface{}, error) 查询单个Key GetMulti(keys []string) (replys []interface{}, error) 查询多个KEY Set(key string, val interface{}, timeout int) error 设置单个Key Del(key string) error 删除key IncrBy(key string, step int) error key自增 DecrBy(key string, step int) error key自减 Do(command string, args ...interface{}) (reply interface{}, error) 未定义的接口使用 // ID生成器,唯一的ID生成 NewID(key string, base int64) (int64, error)
放全局函数
Index ¶
- Variables
- func CondV(cond bool, v1 interface{}, v2 interface{}) interface{}
- func DecrBy(key string, step int) (interface{}, error)
- func Del(key string) error
- func Do(command string, args ...interface{}) (reply interface{}, err error)
- func Expire(key string, timeout int) error
- func Get(key string) (interface{}, error)
- func GetJsonObj(key string, data interface{}) error
- func HGet(keys ...interface{}) (interface{}, error)
- func HMGet(keys ...interface{}) (interface{}, error)
- func HMSet(keys ...interface{}) error
- func HSet(keys ...interface{}) error
- func IDInc(key string) (int64, error)
- func IDIncDirect(key string) (int64, error)
- func IDIncU64(key string) (uint64, error)
- func IncrBy(key string, step int) (interface{}, error)
- func Init(cfg *Config) (err error)
- func MGet(keys []interface{}) (interface{}, error)
- func Set(key string, val interface{}, timeout int) error
- type Config
- type ID
- type Pool
- func (p *Pool) DecrBy(key string, step int) (interface{}, error)
- func (p *Pool) Del(key string) error
- func (p *Pool) Expire(key string, timeout int) error
- func (p *Pool) Get(key string) (interface{}, error)
- func (p *Pool) GetJsonObj(key string, data interface{}) error
- func (p *Pool) HGet(keys []interface{}) (interface{}, error)
- func (p *Pool) HMGet(keys []interface{}) (interface{}, error)
- func (p *Pool) HMSet(keys []interface{}) error
- func (p *Pool) HSet(keys []interface{}) error
- func (p *Pool) IDInc(key string) (int64, error)
- func (p *Pool) IDIncDirect(key string, n int) (int64, error)
- func (p *Pool) IncrBy(key string, step int) (interface{}, error)
- func (p *Pool) MGet(keys []interface{}) (interface{}, error)
- func (p *Pool) Set(key string, val interface{}, timeout int) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
IDsMap sync.Map //用于缓存ID,ID即是需要全局唯一,递增的整型变量
)
Functions ¶
func CondV ¶
func CondV(cond bool, v1 interface{}, v2 interface{}) interface{}
二元组运算的实现 max = b>a ? b : a -> max = CondV(b>a, b, a).(a.Type())
func IDIncDirect ¶
Types ¶
type Config ¶
type Config struct { Server []string ConnTimeOut int // 连接超时时间 单位秒 ReadTimeOut int WriteTimeOut int KeepAlive int AliveTime int }
Config Redis的配置信息
Click to show internal directories.
Click to hide internal directories.