Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue a task queue for mitigating server pressure in high concurrency situations and improving task processing
Example ¶
q := NewQueue(1, 10) q.Run() var count int64 for i := 0; i < 10; i++ { job := NewJob("foo", func(v interface{}) { atomic.AddInt64(&count, 1) }) q.Push(job) } q.Terminate() fmt.Println(count)
Output: 10
type SyncJober ¶
SyncJober a synchronization task that can be executed
func NewSyncJob ¶
NewSyncJob create a synchronization task
Click to show internal directories.
Click to hide internal directories.