Этот коммит содержится в:
Carlos Tadeu Panato Junior
2018-08-16 11:40:46 +02:00
коммит произвёл GitHub
родитель ffb1d8c798 43483805ea
Коммит f24f06c101
17 изменённых файлов: 320 добавлений и 314 удалений

Просмотреть файл

@@ -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)
}
})
}