Files
EasyGoAdmin_GoFrame_EleVue/api/v1/cache_monitor.go
T
2026-10-20 11:37:25 +08:00

42 lines
2.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package v1
import (
"github.com/gogf/gf/v2/util/gmeta"
)
// ============================== 缓存监控模块 ==============================
// CacheInfoReq 查询缓存信息请求
type CacheInfoReq struct {
gmeta.Meta `method:"get" path:"/api/cache/info" summary:"缓存监控信息" log:"缓存监控-查询信息" logType:"query"`
}
// CacheKeySpaceDb 单个库的键空间统计
type CacheKeySpaceDb struct {
Db string `json:"db"` // 库编号(如 db0)
Keys int64 `json:"keys"` // 键数量
Expires int64 `json:"expires"` // 带过期键数量
}
// CacheInfoRes 缓存监控信息结果
type CacheInfoRes struct {
Mode string `json:"mode"` // redis / memory
Connected bool `json:"connected"` // 是否连通
Version string `json:"version"` // Redis 版本
Uptime string `json:"uptime"` // 运行时长
UsedMemory string `json:"usedMemory"` // 已用内存
UsedMemoryPeak string `json:"usedMemoryPeak"` // 内存峰值
MaxMemory string `json:"maxMemory"` // 内存上限(0 表示无限制)
FragRatio string `json:"fragRatio"` // 内存碎片率
ConnectedClients int64 `json:"connectedClients"` // 客户端连接数
Keys int64 `json:"keys"` // 键总数
Hits int64 `json:"hits"` // 命中次数
Misses int64 `json:"misses"` // 未命中次数
HitRate string `json:"hitRate"` // 命中率(%)
ExpiredKeys int64 `json:"expiredKeys"` // 累计过期键数
EvictedKeys int64 `json:"evictedKeys"` // 累计淘汰键数
TotalCommands int64 `json:"totalCommands"` // 累计执行命令数
TotalConns int64 `json:"totalConns"` // 累计连接数
KeySpace []CacheKeySpaceDb `json:"keySpace"` // 键空间明细
}