cronKit

package
v2.2.26 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCron

func NewCron() *cron.Cron

NewCron

!!!: (1) 想要通过修改机器时间来验证的话,需要先改时间,再启动cron. (2) 返回的 *cron.Cron实例 要调用 Run() || Start() 以启动

Run()	会阻塞 调用此方法的goroutine,
Start()	不会阻塞 调用此方法的goroutine

定时任务-表达式

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 "0 0 0 * * *" 每天凌晨0点执行 "* * * * * *" 每秒执行 "30 * * * * *" 每分钟的第30s,执行一次 "15,30 * * * * *" 每分钟的第15s、第30s,各执行一次 "@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

@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