It is very important to set cache timing for your applications. In DNN application/ site you can set cache in host setting page. To do that you need to login with the application/ site with host login and go to “Host Settings” page. Hit the “Advance Settings” tree and then click on “Performance Settings” link. Then you can find a dropdown where all the cache types are listed, name as below,
No Caching: 0
Light Caching: 1
Moderate Caching: 3
Heavy Caching: 6
I will mention later on about the number associated with the cache name, its importance and where you need to choose a cache type, later in this tip.
This is the screenshot of the “Performance Settings” panel.
Below is the code I have picked from hostsetting.aspx file (admin\host\hostsettings.ascx).. To set the cache time of your site you need to set the value with the cache name which will render in the host settings page under performance settings panel.
<asp:dropdownlist runat="server" Width="150">
<asp:listitem resourcekey="NoCaching" value="0">No Caching</asp:listitem>
<asp:listitem resourcekey="LightCaching" value="1">Light Caching</asp:listitem>
<asp:listitem resourcekey="ModerateCaching" value="3">Moderate aching</asp:listitem>
<asp:listitem resourcekey="HeavyCaching" value="6">Heavy Caching</asp:listitem>
The value in dropdown ranges from 0 to 6. The code above takes the value set in the dropdown and multiplies it by 20 to determine the cache duration.