Documentation ¶
Index ¶
- Variables
- type RedisController
- type RedisOperator
- type RedisTaskMgr
- func (mgr *RedisTaskMgr) Destroy(channel string) error
- func (mgr *RedisTaskMgr) Exec(run func(c redis.Conn) error) error
- func (mgr *RedisTaskMgr) Key(channel string) string
- func (mgr *RedisTaskMgr) Push(channel string, task *mq.Task) error
- func (mgr *RedisTaskMgr) Remove(channel, id string) error
- func (mgr *RedisTaskMgr) Shift(channel string) (task *mq.Task, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( QPUSH = redis.NewScript(1, ` local keySet = KEYS[1] .. '::set' local keyQueue = KEYS[1] .. '::queue' local id = ARGV[1] local data = ARGV[2] local success = redis.call('HSETNX', keySet, id, data) if (success == 1) then redis.call('RPUSH', keyQueue, id) end `) QSHIFT = redis.NewScript(1, ` local keySet = KEYS[1] .. '::set' local keyQueue = KEYS[1] .. '::queue' local id = redis.call('LPOP', keyQueue) local data if (id == nil or id == false) then return id end data = redis.call('HGET', keySet, id) redis.call('HDEL', keySet, id) return data `) QDEL = redis.NewScript(1, ` local keySet = KEYS[1] .. '::set' local keyQueue = KEYS[1] .. '::queue' redis.call('DEL', keySet) redis.call('DEL', keyQueue) `) QREM = redis.NewScript(1, ` local keySet = KEYS[1] .. '::set' local id = ARGV[1] redis.call('HDEL', keySet, id) `) )
Functions ¶
This section is empty.
Types ¶
type RedisController ¶
type RedisOperator ¶
func RedisOperatorFromPool ¶
func RedisOperatorFromPool(pool *redis.Pool) *RedisOperator
func (RedisOperator) Prefix ¶
func (RedisOperator) Prefix(key string) string
type RedisTaskMgr ¶
type RedisTaskMgr struct {
// contains filtered or unexported fields
}
func NewRedisTaskMgr ¶
func NewRedisTaskMgr(redisOp RedisController) *RedisTaskMgr
func (*RedisTaskMgr) Destroy ¶
func (mgr *RedisTaskMgr) Destroy(channel string) error
func (*RedisTaskMgr) Key ¶
func (mgr *RedisTaskMgr) Key(channel string) string
func (*RedisTaskMgr) Remove ¶
func (mgr *RedisTaskMgr) Remove(channel, id string) error
Click to show internal directories.
Click to hide internal directories.