public async Task <IActionResult> Rss([FromServices] IBlogCache cache, string routeName = null) { bool hasRoute = !string.IsNullOrWhiteSpace(routeName); var route = hasRoute ? routeName.ToLower().Trim() : null; return(await cache.GetOrCreateAsync( hasRoute?CacheDivision.PostCountCategory : CacheDivision.General, route ?? "rss", async entry => { entry.SlidingExpiration = TimeSpan.FromHours(1); var xml = await _syndicationService.GetRssDataAsync(routeName); if (string.IsNullOrWhiteSpace(xml)) { return (IActionResult)NotFound(); } return Content(xml, "text/xml"); })); }
public HomeController( IPostService postService, IPageService pageService, ITagService tagService, IBlogArchiveService blogArchiveService, IBlogCache cache, IBlogConfig blogConfig, ILogger <HomeController> logger, IOptions <AppSettings> settingsOptions) { _postService = postService; _pageService = pageService; _tagService = tagService; _blogArchiveService = blogArchiveService; _cache = cache; _blogConfig = blogConfig; _logger = logger; _settings = settingsOptions.Value; }
public PostManageService( IBlogAudit audit, ILogger <PostManageService> logger, IConfiguration configuration, IOptions <AppSettings> settings, IRepository <TagEntity> tagRepo, IRepository <PostEntity> postRepo, IBlogCache cache) { _audit = audit; _logger = logger; _tagRepo = tagRepo; _postRepo = postRepo; _cache = cache; _settings = settings.Value; _tagNormalizationDictionary = configuration.GetSection("TagNormalization").Get <Dictionary <string, string> >(); }
public async Task Invoke(HttpContext httpContext, IBlogConfig blogConfig, IBlogCache cache, ISiteMapWriter siteMapWriter) { if (httpContext.Request.Path == "/sitemap.xml") { var xml = await cache.GetOrCreateAsync(CacheDivision.General, "sitemap", async _ => { var url = Helper.ResolveRootUrl(httpContext, blogConfig.GeneralSettings.CanonicalPrefix, true); var data = await siteMapWriter.GetSiteMapData(url); return(data); }); httpContext.Response.ContentType = "text/xml"; await httpContext.Response.WriteAsync(xml); } else { await _next(httpContext); } }
public IActionResult ClearDataCache(string[] cachedObjectValues, [FromServices] IBlogCache cache) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState.CombineErrorMessages())); } if (cachedObjectValues.Contains("MCO_IMEM")) { cache.RemoveAllCache(); } return(Ok()); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public PostService( ILogger <PostService> logger, IOptions <AppSettings> settings, IRepository <PostEntity> postRepo, IRepository <TagEntity> tagRepo, IRepository <PostTagEntity> postTagRepo, IRepository <PostCategoryEntity> postCatRepo, IDateTimeResolver dateTimeResolver, IBlogAudit audit, IBlogCache cache) { _logger = logger; _settings = settings.Value; _postRepo = postRepo; _tagRepo = tagRepo; _postTagRepo = postTagRepo; _postCatRepo = postCatRepo; _dateTimeResolver = dateTimeResolver; _audit = audit; _cache = cache; }
public PostService(ILogger <PostService> logger, IOptions <AppSettings> settings, IRepository <PostEntity> postRepository, IRepository <PostExtensionEntity> postExtensionRepository, IRepository <TagEntity> tagRepository, IRepository <PostTagEntity> postTagRepository, IRepository <CategoryEntity> categoryRepository, IRepository <PostCategoryEntity> postCategoryRepository, IDateTimeResolver dateTimeResolver, IBlogAudit blogAudit, IBlogCache cache) : base(logger, settings) { _postRepository = postRepository; _postExtensionRepository = postExtensionRepository; _tagRepository = tagRepository; _postTagRepository = postTagRepository; _categoryRepository = categoryRepository; _postCategoryRepository = postCategoryRepository; _dateTimeResolver = dateTimeResolver; _blogAudit = blogAudit; _cache = cache; }
public ClearPagingCountCache(IBlogCache cache) { _cache = cache; }
public DeleteSubscriptionCache(ILogger <DeleteSubscriptionCache> logger, IBlogCache cache) { Logger = logger; _cache = cache; }
public ThemeController(IThemeService themeService, IBlogCache cache, IBlogConfig blogConfig) { _themeService = themeService; _cache = cache; _blogConfig = blogConfig; }
public UpdateCategoryCommandHandler(IRepository <CategoryEntity> catRepo, IBlogCache cache) { _catRepo = catRepo; _cache = cache; }
public ClearBlogCache(BlogCacheType type, IBlogCache cache) { _cache = cache; _type = type; }
public MenuViewComponent(IMenuService menuService, IBlogCache cache) { _menuService = menuService; _cache = cache; }
public DeletePagingCountCache(IBlogCache cache) { _cache = cache; }
public RestorePostCommandHandler(IRepository <PostEntity> postRepo, IBlogCache cache) { _postRepo = postRepo; _cache = cache; }
public GetPostBySlugQueryHandler(IRepository <PostEntity> postRepo, IBlogCache cache, IOptions <AppSettings> settings) { _postRepo = postRepo; _cache = cache; _settings = settings.Value; }
public MenuViewComponent(IBlogCache cache, IMediator mediator) { _cache = cache; _mediator = mediator; }
public ClearSubscriptionCache(IBlogCache cache) { _cache = cache; }
public IActionResult ClearDataCache(string[] cachedObjectValues, [FromServices] IBlogCache cache) {
public DeleteBlogCacheDivision(CacheDivision division, IBlogCache cache) { _division = division; _cache = cache; }
public TagListModel( ITagService tagService, IBlogConfig blogConfig, IPostQueryService postQueryService, IBlogCache cache) { _tagService = tagService; _blogConfig = blogConfig; _postQueryService = postQueryService; _cache = cache; P = 1; }
public async Task <IActionResult> SiteMap([FromServices] IBlogConfig blogConfig, [FromServices] IBlogCache cache) { return(await cache.GetOrCreateAsync(CacheDivision.General, "sitemap", async entry => { var url = ResolveRootUrl(blogConfig); var bytes = await _searchService.GetSiteMapStreamArrayAsync(url); var xmlContent = Encoding.UTF8.GetString(bytes); return Content(xmlContent, "text/xml"); })); }
public ClearSiteMapCache(IBlogCache cache) { _cache = cache; }
public GetCategoriesQueryHandler(IRepository <CategoryEntity> catRepo, IBlogCache cache) { _catRepo = catRepo; _cache = cache; }
public async Task <IActionResult> SiteMap([FromServices] IBlogConfig blogConfig, [FromServices] IBlogCache cache) { return(await cache.GetOrCreateAsync(CacheDivision.General, "sitemap", async _ => { var url = Helper.ResolveRootUrl(HttpContext, blogConfig.GeneralSettings.CanonicalPrefix, true); var bytes = await _searchService.GetSiteMapStreamArrayAsync(url); var xmlContent = Encoding.UTF8.GetString(bytes); return Content(xmlContent, "text/xml"); })); }
public DeleteSiteMapCache(ILogger <DeleteSiteMapCache> logger, IBlogCache cache) { Logger = logger; _cache = cache; }
public DeleteBlogCache(CacheDivision division, string cacheKey, IBlogCache cache) { _division = division; _cacheKey = cacheKey; _cache = cache; }
public PurgeRecycledCommandHandler(IBlogCache cache, IRepository <PostEntity> postRepo) { _cache = cache; _postRepo = postRepo; }