diff --git a/pkg/common/db/cache/black.go b/pkg/common/db/cache/black.go index e4a8b1f4f..bd4640eba 100644 --- a/pkg/common/db/cache/black.go +++ b/pkg/common/db/cache/black.go @@ -46,7 +46,7 @@ func (b *BlackCacheRedis) NewCache() BlackCache { expireTime: b.expireTime, rcClient: b.rcClient, blackDB: b.blackDB, - metaCache: NewMetaCacheRedis(b.rcClient), + metaCache: NewMetaCacheRedis(b.rcClient, b.metaCache.GetPreDeleteKeys()...), } } diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index add27b3c3..57b97c165 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -68,7 +68,7 @@ func NewNewConversationRedis(rdb redis.UniversalClient, conversationDB *relation } func (c *ConversationRedisCache) NewCache() ConversationCache { - return &ConversationRedisCache{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient), conversationDB: c.conversationDB, expireTime: c.expireTime} + return &ConversationRedisCache{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient, c.metaCache.GetPreDeleteKeys()...), conversationDB: c.conversationDB, expireTime: c.expireTime} } func (c *ConversationRedisCache) getConversationKey(ownerUserID, conversationID string) string { diff --git a/pkg/common/db/cache/extend_msg_set.go b/pkg/common/db/cache/extend_msg_set.go index 37ef2cf42..a4440437a 100644 --- a/pkg/common/db/cache/extend_msg_set.go +++ b/pkg/common/db/cache/extend_msg_set.go @@ -40,7 +40,7 @@ func NewExtendMsgSetCacheRedis(rdb redis.UniversalClient, extendMsgSetDB unrelat func (e *ExtendMsgSetCacheRedis) NewCache() ExtendMsgSetCache { return &ExtendMsgSetCacheRedis{ - metaCache: e.metaCache, + metaCache: NewMetaCacheRedis(e.rcClient, e.metaCache.GetPreDeleteKeys()...), expireTime: e.expireTime, extendMsgSetDB: e.extendMsgSetDB, rcClient: e.rcClient, diff --git a/pkg/common/db/cache/friend.go b/pkg/common/db/cache/friend.go index f74df8975..a7540c56e 100644 --- a/pkg/common/db/cache/friend.go +++ b/pkg/common/db/cache/friend.go @@ -48,7 +48,7 @@ func NewFriendCacheRedis(rdb redis.UniversalClient, friendDB relationTb.FriendMo } func (c *FriendCacheRedis) NewCache() FriendCache { - return &FriendCacheRedis{rcClient: c.rcClient, metaCache: c.metaCache, friendDB: c.friendDB, expireTime: c.expireTime} + return &FriendCacheRedis{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient, c.metaCache.GetPreDeleteKeys()...), friendDB: c.friendDB, expireTime: c.expireTime} } func (f *FriendCacheRedis) getFriendIDsKey(ownerUserID string) string { diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index 657452f31..93954f3e1 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -70,7 +70,7 @@ func NewGroupCacheRedis(rdb redis.UniversalClient, groupDB relationTb.GroupModel } func (g *GroupCacheRedis) NewCache() GroupCache { - return &GroupCacheRedis{rcClient: g.rcClient, expireTime: g.expireTime, groupDB: g.groupDB, groupMemberDB: g.groupMemberDB, groupRequestDB: g.groupRequestDB, mongoDB: g.mongoDB, metaCache: g.metaCache} + return &GroupCacheRedis{rcClient: g.rcClient, expireTime: g.expireTime, groupDB: g.groupDB, groupMemberDB: g.groupMemberDB, groupRequestDB: g.groupRequestDB, mongoDB: g.mongoDB, metaCache: NewMetaCacheRedis(g.rcClient, g.metaCache.GetPreDeleteKeys()...)} } func (g *GroupCacheRedis) getGroupInfoKey(groupID string) string { diff --git a/pkg/common/db/cache/rockscache.go b/pkg/common/db/cache/rockscache.go index fc7aae02b..36c2f449c 100644 --- a/pkg/common/db/cache/rockscache.go +++ b/pkg/common/db/cache/rockscache.go @@ -24,8 +24,8 @@ type metaCache interface { GetPreDeleteKeys() []string } -func NewMetaCacheRedis(rcClient *rockscache.Client) metaCache { - return &metaCacheRedis{rcClient: rcClient} +func NewMetaCacheRedis(rcClient *rockscache.Client, keys ...string) metaCache { + return &metaCacheRedis{rcClient: rcClient, keys: keys} } type metaCacheRedis struct { diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go index 60ed9d8c9..0679720d2 100644 --- a/pkg/common/db/cache/user.go +++ b/pkg/common/db/cache/user.go @@ -44,7 +44,7 @@ func NewUserCacheRedis(rdb redis.UniversalClient, userDB relationTb.UserModelInt func (u *UserCacheRedis) NewCache() UserCache { return &UserCacheRedis{ - metaCache: u.metaCache, + metaCache: NewMetaCacheRedis(u.rcClient, u.metaCache.GetPreDeleteKeys()...), userDB: u.userDB, expireTime: u.expireTime, rcClient: u.rcClient,