1、客户端缓存(浏览器缓存) HTTP有一套控制缓存的协议-RFC7234,其中最重要的就是cache-control这个相应报文头,服务器返回时,如果Response带上 cache-control:max-age=5 #表示允许浏览器缓存5秒(仅是允许,浏览器是否缓存还看浏览器本身机制是否要遵循这套缓存协议) Net 封装好了一个缓存特性,如: public class HomeController : ControllerBase { [ResponseCache(Duration = 5)]//告诉浏览器可用缓存5秒,Duration必须定义,不然请求会报错 [HttpGet("GetNowDateTime")] public string GetNowDateTime() { return DateTime.Now.ToString(); } } 执行多次请求 第一行为首次请求,Response Headers: cache-control: public,max-age=5 #告诉浏览器进行缓存 content-encoding: gzip content-type:...