diff options
author | Corey Hulen <corey@hulen.com> | 2016-11-10 06:25:23 -0800 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-11-10 09:25:23 -0500 |
commit | 41b31b4c92932a74bb8cc9fbe6b64d327d903a37 (patch) | |
tree | d0a664c1e1f4b6c054f72a7ff201524385a2efaf /store/sql_user_store.go | |
parent | b46ced78def34f81742072c493992afff62c6fb7 (diff) | |
download | chat-41b31b4c92932a74bb8cc9fbe6b64d327d903a37.tar.gz chat-41b31b4c92932a74bb8cc9fbe6b64d327d903a37.tar.bz2 chat-41b31b4c92932a74bb8cc9fbe6b64d327d903a37.zip |
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
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r-- | store/sql_user_store.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 984b544d7..aa3bb4380 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -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) } |