2013-02-27 75 views

回答

1

如果在數據庫中更新數據,我會得到更新的數據嗎?

什麼是緩存,是它的全部響應或只是將文件?

上次緩存之前呈現給客戶端的HTML標記。

1

我同意@ Darin的評論。您可以使用OutputCache來代替使用CacheFilterAttribute。

namespace MvcApplication1.Controllers 
{ 
    [HandleError] 
    public class HomeController : Controller 
    { 
     [OutputCache(Duration=10, VaryByParam="none")] 
     public ActionResult Index() 
     { 
      return View(); 
     } 

    } 
} 

或者您可以創建輸出緩存配置文件並指定此web.config文件。

請參閱http://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute(v=vs.108).aspx