refactor(cache): remove deprecated unread count methods and keys
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:
14
internal/cache/keys.go
vendored
14
internal/cache/keys.go
vendored
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user