Documentation
¶
Index ¶
- type Options
- type RedisQueue
- func (r *RedisQueue) Add(workerName string, item *queue.QueueItem) error
- func (r *RedisQueue) CleanupQueue(workerName string) error
- func (r *RedisQueue) Close() error
- func (r *RedisQueue) Count(workerName string) int
- func (r *RedisQueue) Del(workerName string, id string) error
- func (r *RedisQueue) FlushAll() error
- func (r *RedisQueue) List(workerName string, page int, limit int) []*queue.QueueItem
- func (r *RedisQueue) Pop(workerName string, num int) []*queue.QueueItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { Client *redis.Client Addr string Password string DB int Prefix string PoolSize int Timeout time.Duration }
Options Redis 队列选项
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions 返回默认选项 DefaultOptions returns default options
func WithClient ¶
func WithClient(client *redis.Client) *Options
WithClient 使用现有的 Redis 客户端 WithClient uses an existing Redis client
type RedisQueue ¶
type RedisQueue struct {
// contains filtered or unexported fields
}
RedisQueue 是 Redis 队列驱动实现
func New ¶
func New(opts *Options) (*RedisQueue, error)
New 创建新的 Redis 队列实例 New creates a new Redis queue instance
func (*RedisQueue) Add ¶
func (r *RedisQueue) Add(workerName string, item *queue.QueueItem) error
Add 添加队列项 Add adds an item to the queue
func (*RedisQueue) CleanupQueue ¶
func (r *RedisQueue) CleanupQueue(workerName string) error
CleanupQueue 清理队列(仅用于测试/管理) CleanupQueue cleans up the queue (for testing/management only)
func (*RedisQueue) Count ¶
func (r *RedisQueue) Count(workerName string) int
Count 获取队列中的项目数量 Count gets the number of items in the queue
func (*RedisQueue) Del ¶
func (r *RedisQueue) Del(workerName string, id string) error
Del 从队列中删除指定的项 Del removes the specified item from the queue
func (*RedisQueue) FlushAll ¶
func (r *RedisQueue) FlushAll() error
FlushAll 清空所有队列数据(仅用于测试/管理) FlushAll flushes all queue data (for testing/management only)
func (*RedisQueue) List ¶
func (r *RedisQueue) List(workerName string, page int, limit int) []*queue.QueueItem
List 获取分页的队列项列表 List gets a paginated list of queue items
func (*RedisQueue) Pop ¶
func (r *RedisQueue) Pop(workerName string, num int) []*queue.QueueItem
Pop 从队列中弹出指定数量的项 Pop pops specified number of items from the queue