Documentation ¶
Index ¶
- func Now() time.Time
- func ReleaseTimer(timer *Timer)
- func StartTimer(minTimerInterval time.Duration, maxTimerNum int)
- type Cron
- type CronExpr
- type Dispatcher
- func (dispatcher *Dispatcher) AfterFunc(d time.Duration, cb func(uint64, interface{}), cbEx func(*Timer), ...) *Timer
- func (dispatcher *Dispatcher) CronFunc(cronExpr *CronExpr, cb func(uint64, interface{}), cbEx func(*Cron), ...) *Cron
- func (dispatcher *Dispatcher) TickerFunc(d time.Duration, cb func(uint64, interface{}), cbEx func(*Ticker), ...) *Ticker
- type ITimer
- type OnAddTimer
- type OnCloseTimer
- type Ticker
- type Timer
- func (t *Timer) AppendChannel(timer ITimer)
- func (t *Timer) Cancel()
- func (t *Timer) Do()
- func (t *Timer) GetFireTime() time.Time
- func (t *Timer) GetId() uint64
- func (t *Timer) GetInterval() time.Duration
- func (t *Timer) GetName() string
- func (t *Timer) IsActive() bool
- func (t *Timer) IsOpen() bool
- func (t *Timer) IsRef() bool
- func (t *Timer) Open(bOpen bool)
- func (t *Timer) Ref()
- func (t *Timer) Reset()
- func (t *Timer) SetupTimer(now time.Time) error
- func (t *Timer) UnRef()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReleaseTimer ¶
func ReleaseTimer(timer *Timer)
func StartTimer ¶
Types ¶
type CronExpr ¶
type CronExpr struct {
// contains filtered or unexported fields
}
Field name | Mandatory? | Allowed values | Allowed special characters ---------- | ---------- | -------------- | -------------------------- Seconds | No | 0-59 | * / , - Minutes | Yes | 0-59 | * / , - Hours | Yes | 0-23 | * / , - Day of month | Yes | 1-31 | * / , - Month | Yes | 1-12 | * / , - Day of week | Yes | 0-6 | * / , -
type Dispatcher ¶
type Dispatcher struct {
ChanTimer chan ITimer
}
one dispatcher per goroutine (goroutine not safe)
func NewDispatcher ¶
func NewDispatcher(l int) *Dispatcher
func (*Dispatcher) AfterFunc ¶
func (dispatcher *Dispatcher) AfterFunc(d time.Duration, cb func(uint64, interface{}), cbEx func(*Timer), onTimerClose OnCloseTimer, onAddTimer OnAddTimer) *Timer
func (*Dispatcher) CronFunc ¶
func (dispatcher *Dispatcher) CronFunc(cronExpr *CronExpr, cb func(uint64, interface{}), cbEx func(*Cron), onTimerClose OnCloseTimer, onAddTimer OnAddTimer) *Cron
func (*Dispatcher) TickerFunc ¶
func (dispatcher *Dispatcher) TickerFunc(d time.Duration, cb func(uint64, interface{}), cbEx func(*Ticker), onTimerClose OnCloseTimer, onAddTimer OnAddTimer) *Ticker
type ITimer ¶
type ITimer interface { GetId() uint64 Cancel() GetName() string IsActive() bool IsOpen() bool Open(bOpen bool) AppendChannel(timer ITimer) Do() GetFireTime() time.Time SetupTimer(now time.Time) error }
ITimer
func SetupTimer ¶
type OnAddTimer ¶
type OnAddTimer func(timer ITimer)
type OnCloseTimer ¶
type OnCloseTimer func(timer ITimer)
type Timer ¶
type Timer struct { Id uint64 C chan ITimer //定时器管道 AdditionData interface{} //定时器附加数据 // contains filtered or unexported fields }
Timer
func (*Timer) AppendChannel ¶
func (*Timer) GetFireTime ¶
func (*Timer) GetInterval ¶
Click to show internal directories.
Click to hide internal directories.