Documentation
¶
Index ¶
- func CronInstance() *cron.Cron
- func DoOnce(job cron.Job, t ...time.Duration) error
- func GetCron() *cron.Cron
- func Register(name, spec string, function TaskFunc) (cron.EntryID, error)
- func RegisterSingleton(name, spec string, function TaskFunc) (cron.EntryID, error)
- func Remove(name string) error
- func SetCron(instance *cron.Cron)
- type Task
- type TaskFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register 注册具名定时任务。 相同名称重复注册返回错误;任务执行时自动附带 panic 恢复与结构化日志。 任务需要由 CronInstance().Start() 启动调度后才会执行。
func RegisterSingleton ¶
RegisterSingleton 注册具名单例任务:同一任务在执行期间不允许再次触发。 适用场景:定时任务执行时间可能超过调度间隔的任务(如批量同步)。
Types ¶
Click to show internal directories.
Click to hide internal directories.