This commit is contained in:
hermes-$(hostname) committed 2026-07-08 08:53:48 +00:00
1 parent f5cf3f4440
commit 0fcdbc5f6c
29 files changed
+773 -264

No files matched your search

+13 -9
View File
@@ -484,9 +484,20 @@ func RedisDbsize(c *gin.Context) {
func RedisScanKeys(c *gin.Context) {
id := c.Param("id")
dbParam := c.Query("db")
rawPattern := strings.TrimSpace(c.DefaultQuery("pattern", "*"))
type KeyInfo struct {
Key string `json:"key"`
Type string `json:"type"`
TTL int64 `json:"ttl"`
}
rawPattern := strings.TrimSpace(c.Query("pattern"))
if rawPattern == "" {
rawPattern = "*"
c.JSON(http.StatusOK, gin.H{
"keys": []KeyInfo{},
"cursor": 0,
"total": 0,
})
return
}
pattern := rawPattern
hasWildcard := strings.ContainsAny(pattern, "*?[")
@@ -512,13 +523,6 @@ func RedisScanKeys(c *gin.Context) {
ctx := context.Background()
// Get types for each key
type KeyInfo struct {
Key string `json:"key"`
Type string `json:"type"`
TTL int64 `json:"ttl"`
}
// Redis Cluster 精确 key 查询应优先走槽位路由直查。全量 SCAN 需要访问各 master,
// 在 NAT/代理暴露单入口时容易受节点通告地址影响。
if !hasWildcard && pattern != "*" {