I noticed that the outputcache 4 Umbraco wasn't running in 4.5. I wanted to share my solution. I could make a module for it to make it even easier, but it's really a simple fix.
First, create a MasterPage class as follows:
public class CachedUmbracoTemplate : MasterPage { public CachedUmbracoTemplate() { this.Load += new EventHandler(CachedUmbracoTemplate_Load); }
Looks like the AddFileDependency doesn't work when you add from within the masterpage. It's probably not exactly what you want anyway. Here's revision 1.1 that uses the AfterPublish event to signal to ASP.NET that all cached pages are invalid. I am invalidating all files when any one is published as we are reusing a lot of content - pulling touts in from one page to another. Log4Net is optional, of course, but is handy since it shows the caching in action.
Output Caching in 4.5
I noticed that the outputcache 4 Umbraco wasn't running in 4.5. I wanted to share my solution. I could make a module for it to make it even easier, but it's really a simple fix.
First, create a MasterPage class as follows:
Then, in any templates for document types that need output caching, just make the masterpage subclass your new CachedUmbracoTemplate:
Et Voila.
Looks like the AddFileDependency doesn't work when you add from within the masterpage. It's probably not exactly what you want anyway. Here's revision 1.1 that uses the AfterPublish event to signal to ASP.NET that all cached pages are invalid. I am invalidating all files when any one is published as we are reusing a lot of content - pulling touts in from one page to another. Log4Net is optional, of course, but is handy since it shows the caching in action.
is working on a reply...