memory

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryQueue

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

MemoryQueue 是基于内存的队列实现

func New

func New(maxRetries int) *MemoryQueue

New 创建一个新的内存队列

func (*MemoryQueue) Clear

func (m *MemoryQueue) Clear(ctx context.Context, queueName string) error

Clear 清空队列

func (*MemoryQueue) Delete

func (m *MemoryQueue) Delete(ctx context.Context, queueName string, jobID string) error

Delete 删除任务

func (*MemoryQueue) Get

func (m *MemoryQueue) Get(ctx context.Context, queueName string, jobID string) (*queue.Job, error)

Get 获取任务信息

func (*MemoryQueue) ProcessNext

func (m *MemoryQueue) ProcessNext(ctx context.Context, queueName string) error

ProcessNext 处理队列中的下一个任务

func (*MemoryQueue) Push

func (m *MemoryQueue) Push(ctx context.Context, queueName string, jobName string, payload map[string]interface{}) (string, error)

Push 将任务推送到队列

func (*MemoryQueue) PushWithDelay

func (m *MemoryQueue) PushWithDelay(ctx context.Context, queueName string, jobName string, payload map[string]interface{}, delay time.Duration) (string, error)

PushWithDelay 将任务推送到队列,延迟指定时间后执行

func (*MemoryQueue) Register

func (m *MemoryQueue) Register(jobName string, handler queue.Handler)

Register 注册任务处理器

func (*MemoryQueue) Retry

func (m *MemoryQueue) Retry(ctx context.Context, queueName string, jobID string) error

Retry 重试失败的任务

func (*MemoryQueue) Schedule

func (m *MemoryQueue) Schedule(ctx context.Context, queueName string, jobName string, payload map[string]interface{}, scheduledAt time.Time) (string, error)

Schedule 计划一个任务在指定时间执行

func (*MemoryQueue) Size

func (m *MemoryQueue) Size(ctx context.Context, queueName string) (int, error)

Size 获取队列大小

func (*MemoryQueue) StartWorker

func (m *MemoryQueue) StartWorker(ctx context.Context, queueName string, concurrency int) error

StartWorker 启动工作进程处理任务

func (*MemoryQueue) StopWorker

func (m *MemoryQueue) StopWorker(ctx context.Context, queueName string) error

StopWorker 停止工作进程

Jump to

Keyboard shortcuts

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