1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00
This commit is contained in:
2023-11-03 15:48:33 +08:00
parent bdbf18969e
commit 249d3b4682
8 changed files with 630 additions and 0 deletions

20
concurrent/readme.md Normal file
View File

@ -0,0 +1,20 @@
延迟队列
包含以下实现模型
1. 内存模式。
2. Redis模式
3. MQ模式
内存模式,在队列中放入。定时检查过期时间,过期时间到达时取出并使用协程执行。
Redis模式使用ZSET存储任务队列。定时取出规则内的任务。取出后使用ZREM删除并放入执行队列LPUSH。放入成功后在任务执行通道发送消息执行通道使用LPOP取出并执行。
```
queue := delayqueue.New()
```