private void RefreshMemberOfMemberTypes(int[] memberTypeIds) { const int pageSize = 500; IEnumerable <IMemberType> memberTypes = _memberTypeService.GetAll(memberTypeIds); foreach (IMemberType memberType in memberTypes) { var page = 0; var total = long.MaxValue; while (page * pageSize < total) { IEnumerable <IMember> memberToRefresh = _memberService.GetAll( page++, pageSize, out total, "LoginName", Direction.Ascending, memberType.Alias); foreach (IMember c in memberToRefresh) { _umbracoIndexingHandler.ReIndexForMember(c); } } } }
public void Handle(MemberCacheRefresherNotification args) { if (!_umbracoIndexingHandler.Enabled) { return; } if (Suspendable.ExamineEvents.CanIndex == false) { return; } switch (args.MessageType) { case MessageType.RefreshById: IMember?c1 = _memberService.GetById((int)args.MessageObject); if (c1 != null) { _umbracoIndexingHandler.ReIndexForMember(c1); } break; case MessageType.RemoveById: // This is triggered when the item is permanently deleted _umbracoIndexingHandler.DeleteIndexForEntity((int)args.MessageObject, false); break; case MessageType.RefreshByInstance: if (args.MessageObject is IMember c3) { _umbracoIndexingHandler.ReIndexForMember(c3); } break; case MessageType.RemoveByInstance: // This is triggered when the item is permanently deleted if (args.MessageObject is IMember c4) { _umbracoIndexingHandler.DeleteIndexForEntity(c4.Id, false); } break; case MessageType.RefreshByPayload: var payload = (MemberCacheRefresher.JsonPayload[])args.MessageObject; foreach (MemberCacheRefresher.JsonPayload p in payload) { if (p.Removed) { _umbracoIndexingHandler.DeleteIndexForEntity(p.Id, false); } else { IMember?m = _memberService.GetById(p.Id); if (m != null) { _umbracoIndexingHandler.ReIndexForMember(m); } } } break; case MessageType.RefreshAll: case MessageType.RefreshByJson: default: // We don't support these, these message types will not fire for unpublished content break; } }