Can someone please shed some light into this? An action is decorated this way:
[OutputCache(Duration = 5, VaryByParam = "none")]
public ActionResult MyAction()
{
// DO STUFF HERE...
}
The MyAction invokes a view which has a form (which posts back to the MyAction POSTED-Method).
The mechanism (of posting back) works fine. I declare Duration 5, meaning 5 seconds (or not?). So after 5 seconds if call it again
http://myAddress/MyController/MyAction
. . . the action is not called! Why? What am i missing?
Thanks in advance!
Try to rule out client-side caching. (Clear the cache in your browser, or use a different browser, add a dummy parameter etc.) Your browser is more likely to cache this content than non-output-cached pages because MVC actually sends a suggestion to the client to cache the content for the specified time. I wouldn’t be surprised if your browser took that suggestion and decided to cache longer than suggested.
At what point does your server-side code trigger again? 20 seconds? 40? ever?