General.Web/Controllers/Admin/ClearCacheController.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using General.Core.Config;
using General.Framework;
using General.Mvc.Filters;
using General.Services.DiyPage;
using General.Services.Template;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace General.Mvc.Controllers.Admin
{
[Route("api/admin/[controller]/[action]")]
[ApiController]
[ServiceFilter(typeof(ResponseLogTimeFilter))]
public class ClearCacheController : Controller
{
private readonly ITemplateService templateService;
private readonly IDiyPageService diyPageService;
private readonly IMemoryCache memoryCache;
public ClearCacheController(ITemplateService templateService,
IDiyPageService diyPageService,
IMemoryCache memoryCache)
{
this.templateService = templateService;
this.diyPageService = diyPageService;
this.memoryCache = memoryCache;
}
/// <summary>
/// 清除模板缓存
/// </summary>
/// <returns></returns>
[HttpPost]
[ServiceFilter(typeof(AdminCheckFilter))]
public async Task<IActionResult> ClearTamplateCache()
{
templateService.ClearTemplateCache();
return Content(JsonHelper.Serialize(new AjaxResult() { code = AjaxResultStateEnum.Ok, message = "清除成功!" }));
}
/// <summary>
/// 清除主页缓存
/// </summary>
/// <returns></returns>
[HttpPost]
[ServiceFilter(typeof(AdminCheckFilter))]
public async Task<IActionResult> ClearMainCache()
{
templateService.ClearMainCache();
return Content(JsonHelper.Serialize(new AjaxResult() { code = AjaxResultStateEnum.Ok, message = "清除成功!" }));
}
后面还有 31 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
