예제 #1
0
 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);
         }
     }));
 }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
 private void ClearBlogFirstLineCache(object sender, BlogEventArgs e)
 {
     _cache.Remove(GetBlogFirstLineKey(e.Model.BlogID));
 }
예제 #4
0
파일: Job.cs 프로젝트: ChloeKurumi/gmgard
 public static Job RemoveBlog(BlogEventArgs args)
 => new Job
 {
     JobType = JobType.RemoveBlog, RemoveBlogArgs = args
 };
예제 #5
0
파일: Job.cs 프로젝트: ChloeKurumi/gmgard
 public static Job AddOrUpdateBlog(BlogEventArgs addOrUpdateBlogArgs)
 => new Job
 {
     JobType = JobType.AddOrUpdateBlog, AddOrUpdateBlogArgs = addOrUpdateBlogArgs
 };