Documentation ¶
Overview ¶
Package rediscli for mgr redis cli
Index ¶
- Constants
- Variables
- func NanoToMills(nanoTime int64) int64
- func SecKillRetCodeToError(retCode int64) error
- type DLock
- type LockService
- type RedisCli
- func (p *RedisCli) Decrease(pool, key string) (string, error)
- func (p *RedisCli) Delete(key string) (bool, error)
- func (p *RedisCli) DescBy(key string, count int64) (int64, error)
- func (p *RedisCli) Exists(key string) bool
- func (p *RedisCli) Expire(key string, second int) error
- func (p *RedisCli) Get(key string) ([]byte, error)
- func (p *RedisCli) IncrBy(key string, count int64) (int64, error)
- func (p *RedisCli) Increase(key string) (string, error)
- func (p *RedisCli) LPop(key string) (string, error)
- func (p *RedisCli) LRange(key string, begin, end int) ([]string, error)
- func (p *RedisCli) LikeDeletes(key string) error
- func (p *RedisCli) RPush(key string, value string) (int64, error)
- func (p *RedisCli) RPushAndSetExpire(key string, value string, second int) (int64, error)
- func (p *RedisCli) Set(key, value string, time int) error
- func (p *RedisCli) SetNX(key, value string, time int) error
- func (p *RedisCli) TTL(key string) (int, error)
- type RedisFactory
- type RedisSetnxLock
- type SecKill
Constants ¶
View Source
const ( DEFAULT_MAX_CONN = 3500 DEFAULT_MAX_IDEL_CONN = 3000 DEFAULT_IDEL_TIMEOUT = 300 // use time.Second )
View Source
const (
KEY_PREFIX = "redislock::"
)
Variables ¶
View Source
var ( SecKillErrKeyNotExist = errors.New("key not exist") SecKillErrSelledOut = errors.New("selled out") SecKillErrNotEnough = errors.New("not enough") )
View Source
var KeyExistError = errors.New("rediskey exist")
Functions ¶
func NanoToMills ¶
func SecKillRetCodeToError ¶
SecKillRetCodeToError func get code to err
Types ¶
type LockService ¶
type RedisCli ¶
RedisCli redis cli instance
func (*RedisCli) LikeDeletes ¶
LikeDeletes batch delete
func (*RedisCli) RPushAndSetExpire ¶
RPush Push back
type RedisFactory ¶
RedisFactory struct
var (
Factory RedisFactory
)
func (*RedisFactory) CreateRedisCli ¶
func (p *RedisFactory) CreateRedisCli(pwd, url string) (*RedisCli, error)
CreateRedisCli func create redis cli
type RedisSetnxLock ¶
type RedisSetnxLock struct { Key string Value string TimeoutSecond int MaxWaitMills int MillsBetweenTries int }
func (RedisSetnxLock) SetTimeout ¶
func (r RedisSetnxLock) SetTimeout(redisCli *RedisCli) error
func (RedisSetnxLock) TryLock ¶
func (r RedisSetnxLock) TryLock(redisCli *RedisCli) error
type SecKill ¶
type SecKill struct {
RedisCli *RedisCli
}
SecKill sec kill struct
func CreateSecKillHandler ¶
CreateSecKillHandler func create sec kill handler
Click to show internal directories.
Click to hide internal directories.