CSharp-Single-EFCore/Bunny.WebApi/Controllers/Base/TemplateController.cs

30 lines
734 B
C#

using Bunny.Common.Exception;
using Bunny.Dao.Models.System;
using Bunny.Dao.Result;
using Bunny.Service.IService;
using Microsoft.AspNetCore.Mvc;
namespace Bunny.WebApi.Controllers.Base;
/// <summary>
/// 测试请求模板
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class TemplateController : ControllerBase
{
public IBaseService? BaseService { get; set; }
/// <summary>
/// 测试走缓存
/// </summary>
/// <returns></returns>
[HttpGet("GetCacheController")]
public Result<string> CacheControl()
{
Response.Headers.CacheControl = "max-age=20";
return Result<string>.Success($"测试走缓存内容:{Response.Headers.CacheControl}");
}
}