修复缓存没有更新的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m13s

This commit is contained in:
2026-05-11 10:38:52 +08:00
parent 97851c2595
commit a9eaf1d697
5 changed files with 145 additions and 31 deletions

View File

@@ -339,8 +339,14 @@ func RedisPackageActivationLockKey(carrierType string, carrierID uint) string {
// RedisListCountKey 列表查询计数缓存键
// 用途:缓存分页列表的 COUNT(*) 结果,避免每次翻页重复全表计数
// 过期时间30 秒
func RedisListCountKey(table string, userID uint, filterHash string) string {
return fmt.Sprintf("list_count:%s:%d:%s", table, userID, filterHash)
func RedisListCountKey(table string, version int64, userID uint, scopeHash string, filterHash string) string {
return fmt.Sprintf("list_count:v2:%s:%d:%d:%s:%s", table, version, userID, scopeHash, filterHash)
}
// RedisListCountVersionKey 列表查询计数缓存版本键
// 用途:数据变更后递增版本,让旧 COUNT(*) 缓存立即失效
func RedisListCountVersionKey(table string) string {
return fmt.Sprintf("list_count_version:%s", table)
}
// ========================================