How to get fresh copy if OutputCache(Location = Ou

2019-08-16 05:16发布

Mono MVC2 application uses controller below to cache order page in browser.

If F5 is pressed in browser, old page is still returned to browser. How to return fresh page if F5 is pressed ? It looks like page is cached in server but OutputCacheLocation.Downstream must cache page only in borwser. Is this bug?

    [Authorize]
    public class DetailController : ControllerBase
    {
        [OutputCache(Location = OutputCacheLocation.Downstream, Duration = 20 * 60,VaryByParam = "_entity")]
        public ActionResult Index(string _entity, int? orderId)
        {
...

1条回答
贼婆χ
2楼-- · 2019-08-16 06:13

I think you may be missing the whole point of caching. Pressing F5 will continue to return the cached page until it has expired (20 mins in your case). If you want to force the server to send the page again you would need to do a hard refresh e.g. Ctrl + F5

查看更多
登录 后发表回答