timewheel

package
v0.0.0-...-2d4ed79 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At

func At(at time.Time, key string, job func())

func Cancel

func Cancel(key string)

func Delay

func Delay(duration time.Duration, key string, job func())

Types

type TimeWheel

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

TimeWheel 能在给定的时限到达的时候执行给定的任务

func New

func New(interval time.Duration, slotNum int) *TimeWheel

func (*TimeWheel) AddJob

func (tw *TimeWheel) AddJob(delay time.Duration, key string, job func())

func (*TimeWheel) RemoveJob

func (tw *TimeWheel) RemoveJob(key string)

func (*TimeWheel) Start

func (tw *TimeWheel) Start()

func (*TimeWheel) Stop

func (tw *TimeWheel) Stop()

Jump to

Keyboard shortcuts

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