Beispiel #1
0
        public override Event UpdateActivityCache(Guid id)
        {
            var cachedEvent = Get(id);
            var @event      = base.UpdateActivityCache(id);

            if (IsCacheable(@event) && (@event.GroupId is null || _groupService.IsActivityFromActiveGroup(@event)))
            {
                _activityIndex.Index(Map(@event));
                _documentIndexer.Index(@event.MediaIds);
                return(@event);
            }

            if (cachedEvent == null)
            {
                return(null);
            }

            _activityIndex.Delete(id);
            _documentIndexer.DeleteFromIndex(cachedEvent.MediaIds);
            _mediaHelper.DeleteMedia(cachedEvent.MediaIds);
            return(null);
        }
Beispiel #2
0
        public override Entities.News UpdateActivityCache(Guid id)
        {
            var cachedNews = Get(id);
            var news       = base.UpdateActivityCache(id);

            if (IsInCache(news) && (news.GroupId is null || _groupService.IsActivityFromActiveGroup(news)))
            {
                _activityIndex.Index(Map(news));
                _documentIndexer.Index(news.MediaIds);
                return(news);
            }

            if (cachedNews == null)
            {
                return(null);
            }

            _activityIndex.Delete(id);
            _documentIndexer.DeleteFromIndex(cachedNews.MediaIds);
            _mediaHelper.DeleteMedia(cachedNews.MediaIds);
            return(null);
        }
Beispiel #3
0
        public override async Task <T> UpdateActivityCacheAsync(Guid id)
        {
            var cachedBulletin = await GetAsync(id);

            var bulletin = await base.UpdateActivityCacheAsync(id);

            if (IsCacheable(bulletin) && (bulletin.GroupId is null || _groupService.IsActivityFromActiveGroup(bulletin)))
            {
                _activityIndex.Index(Map(bulletin));
                _documentIndexer.Index(bulletin.MediaIds);
                return(bulletin);
            }

            if (cachedBulletin == null)
            {
                return(null);
            }

            _activityIndex.Delete(id);
            _documentIndexer.DeleteFromIndex(cachedBulletin.MediaIds);
            _mediaHelper.DeleteMedia(cachedBulletin.MediaIds);
            return(null);
        }