cronKit

package
v2.1.25 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCron

func NewCron() *cron.Cron

NewCron

定时任务-表达式

https://goframe.org/pages/viewpage.action?pageId=30736411

Go 每日一库之定时任务库:cron

https://mp.weixin.qq.com/s/swdijAro2k8LuYu7q_La1A

cron表达式,每天凌晨0点执行定时任务

https://www.cnblogs.com/yddwinter/p/16033633.html

e.g. spec "* * * * * *" 每秒执行 "30 * * * * *" 每分钟的第30s,执行一次 "15,30 * * * * *" 每分钟的第15s、第30s,各执行一次 "0 0 2 * * *" 每天凌晨2点执行 "@every 10s" 从执行Run() || Start()开始,每 10s 执行一次 "@every 1m" 从执行Run() || Start()开始,每 1min 执行一次 "@hourly" 从执行Run() || Start()开始,每 1h 执行一次 "@every 1h30m" 从执行Run() || Start()开始,每 1.5h 执行一次

func NewCronWithJob

func NewCronWithJob(spec string, job cron.Job) (*cron.Cron, cron.EntryID, error)

func NewCronWithTask

func NewCronWithTask(spec string, task func()) (*cron.Cron, cron.EntryID, error)

NewCronWithTask

PS: (1) 第1个返回值: 可以调用 Run() 或 Start() 以启动.(Run()会阻塞调用此方法的goroutine;Start()不会阻塞)

@param spec "@every 10s" || "@every 1m",更多可参考"Golang - 1.docx"

Types

This section is empty.

Jump to

Keyboard shortcuts

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