Documentation ¶
Index ¶
- type CronDispatch
- func (c *CronDispatch) AddCron(job JobFunc, args ...interface{}) string
- func (c *CronDispatch) AddCronDisable(job JobFunc, args ...interface{})
- func (c *CronDispatch) Clear(jobid string)
- func (c *CronDispatch) ClearAll()
- func (c *CronDispatch) Start()
- func (c *CronDispatch) StartCron(jobid string)
- func (c *CronDispatch) Stop(jobid string)
- func (c *CronDispatch) StopAll()
- type CronJob
- type CronQueue
- type JobFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CronDispatch ¶
type CronDispatch struct { ScheduleTable map[string]*CronJob // 停止消息 // contains filtered or unexported fields }
CronDispatch 定时任务调度器
func (*CronDispatch) AddCron ¶
func (c *CronDispatch) AddCron(job JobFunc, args ...interface{}) string
AddCron 添加定时任务
func (*CronDispatch) AddCronDisable ¶ added in v0.0.2
func (c *CronDispatch) AddCronDisable(job JobFunc, args ...interface{})
type CronJob ¶
type CronJob struct { JobID string // 任务ID 由sha 哈希生成 ExprStr string // 任务表达式字符串 Expr *cronexpr.Expression // 解析表达式 NextTime time.Time // expr.Next(now) 下一次执行的时间 LastTime time.Time // 上一次执行时间 JobFunc JobFunc // 需要执行的方法 Type int // 任务类型 0 方法, 1 脚本 Status int // 状态 1 启用 0 停用 Disable chan struct{} // 停用信号量 Enabled bool // 启用状态 ScriptTyp int // 脚本类型 0 数据库脚本 1 shell 脚本 2 其他 Script string // 脚本 // contains filtered or unexported fields }
CronJob 代表一个任务
Click to show internal directories.
Click to hide internal directories.