优化部分并发问题

This commit is contained in:
Yun
2026-05-27 14:09:08 +08:00
parent 448116dc0d
commit ed326b192d
3 changed files with 31 additions and 11 deletions
+11
View File
@@ -0,0 +1,11 @@
package timerx
import "strings"
// sanitizeKeyPrefix 移除 keyPrefix 中的 {} 字符,避免破坏 Redis Cluster hash tag
// Redis Cluster 使用 first {..} 配对作为 hash tag,keyPrefix 中包含的 {} 会干扰此机制
func sanitizeKeyPrefix(keyPrefix string) string {
keyPrefix = strings.ReplaceAll(keyPrefix, "{", "_")
keyPrefix = strings.ReplaceAll(keyPrefix, "}", "_")
return keyPrefix
}