PLT-4716 fixes cache invalidation issue (#4518)
* PLT-4716 fixes cache invalidation issue * Adding missing interface * Adding cache invalidation to channel notification preferences * Adding cache invalidation to channel notification preferences
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
b46ced78de
Коммит
41b31b4c92
@@ -555,6 +555,19 @@ func (us SqlUserStore) GetProfiles(teamId string, offset int, limit int) StoreCh
|
||||
return storeChannel
|
||||
}
|
||||
|
||||
func (us SqlUserStore) InvalidateProfilesInChannelCacheByUser(userId string) {
|
||||
keys := profilesInChannelCache.Keys()
|
||||
|
||||
for _, key := range keys {
|
||||
if cacheItem, ok := profilesInChannelCache.Get(key); ok {
|
||||
userMap := cacheItem.(map[string]*model.User)
|
||||
if _, userInCache := userMap[userId]; userInCache {
|
||||
profilesInChannelCache.Remove(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (us SqlUserStore) InvalidateProfilesInChannelCache(channelId string) {
|
||||
profilesInChannelCache.Remove(channelId)
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ type UserStore interface {
|
||||
UpdateMfaActive(userId string, active bool) StoreChannel
|
||||
Get(id string) StoreChannel
|
||||
GetAll() StoreChannel
|
||||
InvalidateProfilesInChannelCacheByUser(userId string)
|
||||
InvalidateProfilesInChannelCache(channelId string)
|
||||
GetProfilesInChannel(channelId string, offset int, limit int, allowFromCache bool) StoreChannel
|
||||
GetProfilesNotInChannel(teamId string, channelId string, offset int, limit int) StoreChannel
|
||||
|
||||
Ссылка в новой задаче
Block a user