github.com/mad-app/mattermost-server@v5.11.1+incompatible/store/local_cache_supplier_groups.go (about)

     1  // Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package store
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/mattermost/mattermost-server/model"
    10  )
    11  
    12  func (s *LocalCacheSupplier) handleClusterInvalidateGroup(msg *model.ClusterMessage) {
    13  	if msg.Data == CLEAR_CACHE_MESSAGE_DATA {
    14  		s.groupCache.Purge()
    15  	} else {
    16  		s.groupCache.Remove(msg.Data)
    17  	}
    18  }
    19  
    20  func (s *LocalCacheSupplier) GroupCreate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    21  	return s.Next().GroupCreate(ctx, group, hints...)
    22  }
    23  
    24  func (s *LocalCacheSupplier) GroupGet(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    25  	if result := s.doStandardReadCache(ctx, s.groupCache, groupID, hints...); result != nil {
    26  		return result
    27  	}
    28  
    29  	result := s.Next().GroupGet(ctx, groupID, hints...)
    30  
    31  	s.doStandardAddToCache(ctx, s.groupCache, groupID, result, hints...)
    32  
    33  	return result
    34  }
    35  
    36  func (s *LocalCacheSupplier) GroupGetByRemoteID(ctx context.Context, remoteID string, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    37  	return s.Next().GroupGetByRemoteID(ctx, remoteID, groupSource, hints...)
    38  }
    39  
    40  func (s *LocalCacheSupplier) GroupGetAllBySource(ctx context.Context, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    41  	return s.Next().GroupGetAllBySource(ctx, groupSource, hints...)
    42  }
    43  
    44  func (s *LocalCacheSupplier) GroupUpdate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    45  	defer s.doInvalidateCacheCluster(s.groupCache, group.Id)
    46  	return s.Next().GroupUpdate(ctx, group, hints...)
    47  }
    48  
    49  func (s *LocalCacheSupplier) GroupDelete(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    50  	defer s.doInvalidateCacheCluster(s.groupCache, groupID)
    51  	defer s.doClearCacheCluster(s.groupCache)
    52  
    53  	return s.Next().GroupDelete(ctx, groupID, hints...)
    54  }
    55  
    56  func (s *LocalCacheSupplier) GroupGetMemberUsers(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    57  	return s.Next().GroupGetMemberUsers(ctx, groupID, hints...)
    58  }
    59  
    60  func (s *LocalCacheSupplier) GroupGetMemberUsersPage(ctx context.Context, groupID string, offset int, limit int, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    61  	return s.Next().GroupGetMemberUsersPage(ctx, groupID, offset, limit, hints...)
    62  }
    63  
    64  func (s *LocalCacheSupplier) GroupGetMemberCount(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    65  	return s.Next().GroupGetMemberCount(ctx, groupID, hints...)
    66  }
    67  
    68  func (s *LocalCacheSupplier) GroupCreateOrRestoreMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    69  	return s.Next().GroupCreateOrRestoreMember(ctx, groupID, userID, hints...)
    70  }
    71  
    72  func (s *LocalCacheSupplier) GroupDeleteMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    73  	return s.Next().GroupDeleteMember(ctx, groupID, userID, hints...)
    74  }
    75  
    76  func (s *LocalCacheSupplier) GroupCreateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    77  	return s.Next().GroupCreateGroupSyncable(ctx, groupSyncable, hints...)
    78  }
    79  
    80  func (s *LocalCacheSupplier) GroupGetGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    81  	return s.Next().GroupGetGroupSyncable(ctx, groupID, syncableID, syncableType, hints...)
    82  }
    83  
    84  func (s *LocalCacheSupplier) GroupGetAllGroupSyncablesByGroup(ctx context.Context, groupID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    85  	return s.Next().GroupGetAllGroupSyncablesByGroup(ctx, groupID, syncableType, hints...)
    86  }
    87  
    88  func (s *LocalCacheSupplier) GroupUpdateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    89  	return s.Next().GroupUpdateGroupSyncable(ctx, groupSyncable, hints...)
    90  }
    91  
    92  func (s *LocalCacheSupplier) GroupDeleteGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    93  	return s.Next().GroupDeleteGroupSyncable(ctx, groupID, syncableID, syncableType, hints...)
    94  }
    95  
    96  func (s *LocalCacheSupplier) PendingAutoAddTeamMembers(ctx context.Context, minGroupMembersCreateAt int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
    97  	return s.Next().PendingAutoAddTeamMembers(ctx, minGroupMembersCreateAt, hints...)
    98  }
    99  
   100  func (s *LocalCacheSupplier) PendingAutoAddChannelMembers(ctx context.Context, minGroupMembersCreateAt int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
   101  	return s.Next().PendingAutoAddChannelMembers(ctx, minGroupMembersCreateAt, hints...)
   102  }