/// <summary> /// This action, since it is not OutputCache'd will always execute, however the mExampleRepo.GetExamplePage(ID) will return a cached result based on the ID, until that node is updated /// </summary> /// <param name="ID"></param> /// <returns></returns> public ActionResult IndexByID(int ID) { // This call will be cached automatically ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePage(ID); return(View("Index", ExamplePage)); }
// GET: Examples public ActionResult Index() { // This call will be cached automaticall since it is a ".Get_____" ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePages().FirstOrDefault(); return(View(ExamplePage)); }
public ActionResult CachedActionByID(int ID, string SomeString) { // This call will be cached automatically and the cache dependency keys will be added automatically to the output cache ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePage(ID); // Add proper Cache Dependencies mOutputCacheDependencies.AddCacheItemDependency("CustomKey"); return(View("CachedView", ExamplePage)); }
public ActionResult CachedView() { // This call will be cached automatically and the cache dependency keys will be added automatically to the output cache ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePages().FirstOrDefault(); // Add a custom cache key mOutputCacheDependencies.AddCacheItemDependency("CustomKey"); return(View(ExamplePage)); }