timingWheel

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(interval time.Duration, bucketsNum int) *timingWheel

New 初始化 interval 每个时间格子的时长,建议设置为100ms

func NewDefault

func NewDefault(interval time.Duration, bucketsNum int)

func Start

func Start()

Start 开始运行

Types

type Op

type Op struct {
	IsPrecision bool // 是否使用高精度时间格
}

Op 选项

type OpOption

type OpOption func(*Op)

OpOption 选项

type Timer

type Timer struct {
	Id int64 // 唯一ID
	C  chan time.Time

	PlanAt time.Time // 计划执行时间
	// contains filtered or unexported fields
}

func Add

func Add(d time.Duration) *Timer

Add 添加一个定时任务

func AddPrecision

func AddPrecision(d time.Duration) *Timer

AddPrecision 添加一个定时任务(高精度)

func AddTime

func AddTime(t time.Time) *Timer

AddTime 添加一个定时任务

func AddTimePrecision

func AddTimePrecision(t time.Time) *Timer

AddTimePrecision 添加一个定时任务(高精度)

func (*Timer) Stop

func (receiver *Timer) Stop()

Jump to

Keyboard shortcuts

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