Output caching for an ApiController (MVC4 Web API)
问题 I'm trying to cache the output of an ApiController method in Web API. Here's the controller code: public class TestController : ApiController { [OutputCache(Duration = 10, VaryByParam = "none", Location = OutputCacheLocation.Any)] public string Get() { return System.DateTime.Now.ToString(); } } N.B. I'd also tried the OutputCache attribute on the controller itself, as well as several combinations of its parameters. The route is registered in Global.asax: namespace WebApiTest { public class