timewheel

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 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 SimpleHandler

type SimpleHandler[T any] func(*SimpleTimeWheel[T], string, T)

处理函数

type SimpleTimeWheel

type SimpleTimeWheel[T any] struct {
	// contains filtered or unexported fields
}

简单时间轮

func NewSimpleTimeWheel

func NewSimpleTimeWheel[T any](delay time.Duration, numSlot int, handler SimpleHandler[T]) *SimpleTimeWheel[T]

func (*SimpleTimeWheel[T]) Add

func (t *SimpleTimeWheel[T]) Add(key string, value T, delay time.Duration)

添加任务

func (*SimpleTimeWheel[T]) Remove

func (t *SimpleTimeWheel[T]) Remove(key string)

func (*SimpleTimeWheel[T]) Start

func (t *SimpleTimeWheel[T]) Start()

启动时间轮任务

func (*SimpleTimeWheel[T]) Stop

func (t *SimpleTimeWheel[T]) Stop()

Jump to

Keyboard shortcuts

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