refactor(cache): remove deprecated unread count methods and keys
All checks were successful
Build Backend / build (push) Successful in 2m5s
Build Backend / build-docker (push) Successful in 1m19s

Clean up the codebase by removing unused and deprecated unread count
functionality in `ConversationCache` and associated Redis key
generators. This follows the transition to sequence-based unread
calculation.

- Remove `IncrementUnread`, `ClearUnread`, `GetUnreadCountFromHash`,
  `GetAllUnreadCounts`, and `GetTotalUnread` from `ConversationCache`.
- Remove `PrefixUnreadHash` and `PrefixUnreadTotal` constants and
  `UnreadHashKey`/`UnreadTotalKey` helper functions.
- Remove unused `isValidContentType` helper in `MessageHandler`.
This commit is contained in:
2026-05-12 18:26:31 +08:00
parent 8d7e8c427b
commit 06db8e36e4
3 changed files with 1 additions and 53 deletions

View File

@@ -26,9 +26,7 @@ const (
PrefixUnreadSystem = "unread:system"
PrefixUnreadConversation = "unread:conversation"
PrefixUnreadDetail = "unread:detail"
PrefixUnreadHash = "unread:hash"
PrefixUnreadTotal = "unread:total"
// 已读位置相关OpenIM 风格:缓存 hasReadSeq用于 O(1) 未读数计算)
PrefixUserReadSeq = "user_read_seq"
@@ -123,16 +121,6 @@ func UnreadDetailKey(userID, conversationID string) string {
return fmt.Sprintf("%s:%s:%s", PrefixUnreadDetail, userID, conversationID)
}
// UnreadHashKey 生成用户未读数 Hash 缓存键
func UnreadHashKey(userID string) string {
return fmt.Sprintf("%s:%s", PrefixUnreadHash, userID)
}
// UnreadTotalKey 生成用户总未读数计数器键
func UnreadTotalKey(userID string) string {
return fmt.Sprintf("%s:%s", PrefixUnreadTotal, userID)
}
// UserInfoKey 生成用户信息缓存键
func UserInfoKey(userID string) string {
return fmt.Sprintf("%s:%s", PrefixUserInfo, userID)