public Task RemoveBlogAsync(BlogEventArgs b) { return(_client.DeleteAsync(new DocumentPath <BlogIndexed>(b.Model.BlogID), i => i.Refresh(Elasticsearch.Net.Refresh.True)).ContinueWith(r => { if (!r.Result.IsValid) { _logger.LogError(r.Result.DebugInformation); } })); }
public async Task AddOrUpdateBlogAsync(BlogEventArgs b) { using (var scope = _scopeFactory.CreateScope()) { var util = scope.ServiceProvider.GetService <ContextlessBlogUtil>(); var tags = b.Tags; if (tags == null) { var tagUtil = scope.ServiceProvider.GetService <TagUtil>(); tags = await tagUtil.GetTagsInBlogAsync(b.Model.BlogID); } var result = await _client.IndexAsync(BlogIndexed.FromBlogTag(b.Model, tags.Select(t => t.TagName), util.GetPostCount(b.Model)), i => i.Refresh(Elasticsearch.Net.Refresh.True)); if (!result.IsValid) { _logger.LogError(result.DebugInformation); } } }
private void ClearBlogFirstLineCache(object sender, BlogEventArgs e) { _cache.Remove(GetBlogFirstLineKey(e.Model.BlogID)); }
public static Job RemoveBlog(BlogEventArgs args) => new Job { JobType = JobType.RemoveBlog, RemoveBlogArgs = args };
public static Job AddOrUpdateBlog(BlogEventArgs addOrUpdateBlogArgs) => new Job { JobType = JobType.AddOrUpdateBlog, AddOrUpdateBlogArgs = addOrUpdateBlogArgs };