MM-11678: Split the cache for includeDeleted and not includeDeleted memberships requests (#9254)
* MM-11678: Split the cache for includeDeleted and not includeDeleted memberships requests * Updating properly the cache on sucess
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
687700a989
Коммит
e39ebd0883
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user