CacheController.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Threading.Tasks;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Admin.Core.Common.Output;
  4. using Admin.Core.Service.Admin.Cache;
  5. namespace Admin.Core.Controllers.Admin
  6. {
  7. /// <summary>
  8. /// 缓存管理
  9. /// </summary>
  10. public class CacheController : AreaController
  11. {
  12. private readonly ICacheService _cacheServices;
  13. public CacheController(ICacheService cacheServices)
  14. {
  15. _cacheServices = cacheServices;
  16. }
  17. /// <summary>
  18. /// 获取缓存列表
  19. /// </summary>
  20. /// <returns></returns>
  21. [HttpGet]
  22. public IResponseOutput List()
  23. {
  24. return _cacheServices.List();
  25. }
  26. /// <summary>
  27. /// 清除缓存
  28. /// </summary>
  29. /// <param name="cacheKey"></param>
  30. /// <returns></returns>
  31. [HttpDelete]
  32. public async Task<IResponseOutput> Clear(string cacheKey)
  33. {
  34. return await _cacheServices.ClearAsync(cacheKey);
  35. }
  36. }
  37. }