Categorygithub.com/0RaymondJiang0/go-delayqueue
modulepackage
0.1.5
Repository: https://github.com/0raymondjiang0/go-delayqueue.git
Documentation: pkg.go.dev

# README

go-delayqueue

A delay queue implemented in go language

  • 时间轮算法实现的延迟队列,支持细粒度延迟任务执行,用户自定义任务实现,无上下文依赖,可扩展性高。
  • 延迟队列中的任务,支持持久化存储,持久对象可自行实现,默认提供redis持久实现;支持程序中断后的任务恢复,可靠性更高。

详细说明参考如下文章:

使用时间轮算法实现延迟队列 (一)

使用时间轮算法实现延迟队列 (二)

# Functions

单列方法,使用默认的redis持久方案.
单列方法,使用外部传入的持久方案.
No description provided by the author

# Constants

每个task存储到redis当中的key前缀,便于与其他数据的区分度.
轮的时间长度,目前设置为一个小时,也就是时间轮每循环一次需要1小时;默认时间轮上面的每走一步的最小粒度为1秒。.

# Structs

任务采用链表结构.

# Interfaces

executor interface, the business instance need to implement it.
No description provided by the author

# Type aliases

定义一个获取实现具体任务对象的工厂方法,该方法需要在业务项目中定义并实现.