How to Utilize DNN Page Output Caching

DNN > How To
Page output caching was previously a feature of only the Evoq (Previously Professional) editions of DNN. In DNN Community 8.0.0, page output caching was added to give site administrators the ability to cache entire pages. This requires DNN to do less work, by caching the HTML of a page, so that it doesn't have to retrieve it from the database every time. 

Things to Know About Page Output Caching

  1. Caching only takes affect for un-authenticated users. Anyone that is logged into the site will receive a fresh copy, every time they visit a page.
  2. Search engine crawlers will receive a fresh copy of a page, every time they visit. This is so they get the most up to date information for your website.
  3. Caching only takes affect for GET requests; POST requests get a fresh copy of a page. 

Page Output Cache Providers

There are three types of page output cache providers by default; MemoryOutputCachingProvider, DatabaseOutputCachingProvider and FileOutputCachingProvider.
  1. MemoryOutputCachingProvider: A copy of the page will be stored in memory (RAM) on the server.
    • All caching will be done in RAM, and is the quickest available option.  
  2. DatabaseOutputCachingProvider: A copy of the page will be stored in the database, in the OutputCaching table.
    • The speed of this option varies by hosting environment, but generally database access is quicker than reading files from disk, and slower than RAM. 
  3. FileOutputCachingProvider: A copy of the page will be stored in /Portals/[PORTAL_ID]-System/Cache/Pages/
    • File caching is generally not recommended, as it will store all files on the disk, which is the slowest option available. 

Enabling Page Output Caching For a Page

Page output caching must be enabled on a page by page basis. The settings to enable this can be found by going to Admin > Page Management, right clicking the page you wish to enable output caching on, and selecting Page Settings. From there, select the Advanced Settings tab, scroll down to Cache Settings and expand it. First, you will need to select an Output Cache Provider from the ComboBox. Once you have a provider selected, update the following settings:
  • Cache Duration: The number of seconds that that page object is cached for
  • Include/Exclude Params by Default: You should Exclude or Include, depending on the type of content that is located on this page.
    • Exclude parameters: By selecting exclude, you may run into issues where a dynamic module isn't updating properly. When selecting exclude, you may use the next option, Include Params in Cache Variation, to set specific parameters that are "included", and will cause a page to generate again (ignoring cache).
    • Include parameters: By selecting include, a new cached copy of the page will be created when a different query string is passed. This may be helpful when there is a dynamic module on the page, that loads differently, based on the query string.
  • Include Params in Cache Variation: This option is used in combination with the 'Exclude' option from the previous set. 
  • Vary By Limit: Set the maximum number of cached copies of the page to keep. By setting this limit, you can prevent a bot, or some other malicious entity, from changing the query strings and generating thousands of cached copies of one page. 

Purging Page Output Cache

By default, DNN ships with the scheduled task to purge output disabled. This prevents extra site overhead, if you are not using the page output caching feature. If you are using page output caching, you will need to go to Host > Schedule and enable the "Purge Output Cache" task, so DNN can regulate the site caching. 

Add Feedback