1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-17 16:12:42 +08:00
Files
go-mixed/concurrent/readme.md
2023-11-03 15:48:33 +08:00

470 B
Raw Blame History

延迟队列

包含以下实现模型

  1. 内存模式。
  2. Redis模式
  3. MQ模式

内存模式,在队列中放入。定时检查过期时间,过期时间到达时取出并使用协程执行。

Redis模式使用ZSET存储任务队列。定时取出规则内的任务。取出后使用ZREM删除并放入执行队列LPUSH。放入成功后在任务执行通道发送消息执行通道使用LPOP取出并执行。

queue := delayqueue.New()