I am trying to use the OutputCache
attribute in my MVC app and it doesn't appear to work when I use OutputCacheLocation.Client
:
public class HomeController : Controller
{
[OutputCache(Duration=15, Location=OutputCacheLocation.Client)]
public ActionResult Client()
{
ViewBag.Message = "The current time is " + DateTime.Now.ToString("hh:mm:ss");
return View();
}
[OutputCache(Duration=15, Location=OutputCacheLocation.Any)]
public ActionResult Any()
{
ViewBag.Message = "The current time is " + DateTime.Now.ToString("hh:mm:ss");
return View();
}
}
The first one does not cache. I hit the page every second and it changes the time. The second one works. It only changes the time every 15 seconds. Is there something I am missing? I'm debugging this using IE8 and the built in development server in Visual Studio.