Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RTaskElement ¶
type RTaskElement struct { // 任务 key Key string `json:"key"` // 任务内容 Msg string `json:"msg"` // 任务类型 Type string `json:"type"` // 执行时间 ExecuteAtUnix int64 `json:"executeAtUnix"` }
RTaskElement 任务明细
func NewRTaskElement ¶
func NewRTaskElement(msg string, _type string) *RTaskElement
NewRTaskElement 创建新任务
type RTimeWheel ¶
type RTimeWheel struct { // 内置的单例工具,用于保证 stopc 只被关闭一次 sync.Once // contains filtered or unexported fields }
RTimeWheel redis实现的分布式时间轮
func NewRTimeWheel ¶
func NewRTimeWheel(store redis.Store, handle func(context.Context, *RTaskElement) error) *RTimeWheel
NewRTimeWheel 构造 redis 实现的分布式时间轮
func (*RTimeWheel) AddTask ¶
func (r *RTimeWheel) AddTask(ctx context.Context, key string, task *RTaskElement, executeAt time.Time) error
AddTask 添加定时任务
func (*RTimeWheel) RemoveTask ¶
RemoveTask 从 redis 时间轮中删除一个定时任务
Click to show internal directories.
Click to hide internal directories.