简体   繁体   English

ASP.NET 5中API控制器的输出缓存

[英]Output caching of API controllers in ASP.NET 5

Am I correct that in ASP.NET 5 ResponseCacheAttribute has replaced OutputCacheAttribute used in previous ASP.NET MVC releases? 我是否正确,在ASP.NET 5中, ResponseCacheAttribute已替换了以前的ASP.NET MVC版本中使用的OutputCacheAttribute Can it be used to cache responses of API controllers? 可以用来缓存API控制器的响应吗? If not, what do Microsoft offer instead? 如果没有,微软提供什么呢? I tried two free solution for WebAPI2 but was not impressed at all. 我为WebAPI2尝试了两个免费的解决方案,但一点都没有留下深刻的印象。

Yes, you will be able to use the ResponseCacheAttribute . 是的,您将可以使用ResponseCacheAttribute

Because there is no difference between a Web Api Controller and an MVC Controller , you will be able to use the same attributes for both. 因为Web Api Controller和MVC Controller之间没有区别,所以您将能够对两者使用相同的属性。 This will apply whether it is the ResponseCacheAttribute , AuthorizeAttribute , RouteAttribute , or any others. 无论是ResponseCacheAttributeAuthorizeAttributeRouteAttribute还是其他任何RouteAttribute ,这都将适用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM