fix: Notification 重连 + Social 修复 + Following 缓存失效
- Notification Worker 加重连循环,Channel 断开不再静默死亡 - Social: 先写 DB 再发 MQ,修复 DB 失败产生幽灵通知的问题 - Social: MQ 发布失败记日志,不再静默忽略 - 关注/取关后失效该用户的 Following Feed 缓存(24h TTL) - Redis Client 新增 DelByPattern 按模式批量删除缓存
This commit is contained in:
@@ -27,6 +27,17 @@ func (c *Client) Del(ctx context.Context, key string) error {
|
||||
return c.rdb.Del(ctx, key).Err()
|
||||
}
|
||||
|
||||
func (c *Client) DelByPattern(ctx context.Context, pattern string) error {
|
||||
if c == nil || c.rdb == nil {
|
||||
return nil
|
||||
}
|
||||
iter := c.rdb.Scan(ctx, 0, pattern, 0).Iterator()
|
||||
for iter.Next(ctx) {
|
||||
_ = c.rdb.Del(ctx, iter.Val())
|
||||
}
|
||||
return iter.Err()
|
||||
}
|
||||
|
||||
func (c *Client) MGet(cacheCtx context.Context, cacheKeys ...string) ([]interface{}, error) {
|
||||
if c == nil || c.rdb == nil {
|
||||
return nil, errors.New("redis client not initialized")
|
||||
|
||||
Reference in New Issue
Block a user