Documentation
¶
Index ¶
Constants ¶
View Source
const C_TIMER_TICK_INTERVAL = 100 * time.Millisecond // 定时器默认tick精度
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ITimer ¶
type ITimer interface {
// 启动
StartTimer(restorer ...ITimerRestorer)
// 关闭
CloseTimer()
// 添加定时器[当handle返回false时自动删除此TimerHandler]
AddTimer(d time.Duration, handle TTimerHandFunc, opt ...*TimerOpt)
// 添加每天一次的定时器[同上](after0:每天超过零点多少时间)
AddDailyTimer(after0 time.Duration, handle TTimerHandFunc, opt ...*TimerOpt)
// 移除定时器
DelTimer(handle TTimerHandFunc)
DelTimerByName(name string)
}
定时器接口
type ITimerRestorer ¶
type ITimerRestorer interface {
// 恢复状态
Load() map[string]int64
// 保存状态
Save(key string, valAt int64)
}
状态存储接口
type TTimerHandFunc ¶
Click to show internal directories.
Click to hide internal directories.