timers

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

README

定时任务功能包

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunFunc

type RunFunc func(ctx context.Context) error

type Timer

type Timer struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer(ctx context.Context, singletonKey string, store kv.Store) *Timer

func (*Timer) Create

func (s *Timer) Create(keys []string, cron string, runFunc RunFunc) error

func (*Timer) Delete

func (s *Timer) Delete(key string) error

func (*Timer) IsRunning

func (s *Timer) IsRunning() bool

func (*Timer) Start

func (s *Timer) Start(startFunc func(ctx context.Context))

type TimerControl

type TimerControl interface {
	Create(keys []string, cron string, runFunc RunFunc) error
	IsRunning() bool
	Delete(key string) error
	Start(startFunc func(ctx context.Context))
}

Jump to

Keyboard shortcuts

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