I\'m trying to cache the output of an ApiController method in Web API.
Here\'s the controller code:
public class TestController : ApiController
{
You could use this on a regular MVC Controller:
[OutputCache(Duration = 10, VaryByParam = "none", Location = OutputCacheLocation.Any)]
public string Get()
{
HttpContext.Current.Response.Cache.SetOmitVaryStar(true);
return System.DateTime.Now.ToString();
}
but OutputCache attribute is in System.Web.Mvc namespace and not available in an ApiController.