summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-08-16 11:40:46 +0200
committerGitHub <noreply@github.com>2018-08-16 11:40:46 +0200
commitf24f06c101811c472da00aad6aa5ae7d9bc1c18c (patch)
tree58d83a52d4fb00aac1cb95f1c139eef88d4aae49 /store
parentffb1d8c7984657f9351da37a534f94578741ffb5 (diff)
parent43483805eabcb36ef9018f12a82a6d3ac055baf5 (diff)
downloadchat-f24f06c101811c472da00aad6aa5ae7d9bc1c18c.tar.gz
chat-f24f06c101811c472da00aad6aa5ae7d9bc1c18c.tar.bz2
chat-f24f06c101811c472da00aad6aa5ae7d9bc1c18c.zip
Merge release-5.2
Diffstat (limited to 'store')
-rw-r--r--store/sqlstore/channel_store.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go
index c073680f4..e158ba5ea 100644
--- a/store/sqlstore/channel_store.go
+++ b/store/sqlstore/channel_store.go
@@ -1093,6 +1093,7 @@ func (s SqlChannelStore) GetMember(channelId string, userId string) store.StoreC
func (s SqlChannelStore) InvalidateAllChannelMembersForUser(userId string) {
allChannelMembersForUserCache.Remove(userId)
+ allChannelMembersForUserCache.Remove(userId + "_deleted")
if s.metrics != nil {
s.metrics.IncrementMemCacheInvalidationCounter("All Channel Members for User - Remove by UserId")
}
@@ -1163,8 +1164,12 @@ func (s SqlChannelStore) GetMemberForPost(postId string, userId string) store.St
func (s SqlChannelStore) GetAllChannelMembersForUser(userId string, allowFromCache bool, includeDeleted bool) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
+ cache_key := userId
+ if includeDeleted {
+ cache_key += "_deleted"
+ }
if allowFromCache {
- if cacheItem, ok := allChannelMembersForUserCache.Get(userId); ok {
+ if cacheItem, ok := allChannelMembersForUserCache.Get(cache_key); ok {
if s.metrics != nil {
s.metrics.IncrementMemCacheHitCounter("All Channel Members for User")
}
@@ -1213,7 +1218,7 @@ func (s SqlChannelStore) GetAllChannelMembersForUser(userId string, allowFromCac
result.Data = ids
if allowFromCache {
- allChannelMembersForUserCache.AddWithExpiresInSecs(userId, ids, ALL_CHANNEL_MEMBERS_FOR_USER_CACHE_SEC)
+ allChannelMembersForUserCache.AddWithExpiresInSecs(cache_key, ids, ALL_CHANNEL_MEMBERS_FOR_USER_CACHE_SEC)
}
})
}