Disable output cache for backend users
The Sitefinity CMS output cache mechanism invalidates a page from cache when someone edits the page or one of the cache dependencies for that page, for example the template it’s based on or some of the content items displayed on this page. When someone request the page for the first time, Sitefinity CMS creates a cache item, and serves the page from cache for consecutive requests. This behavior helps serving pages faster and guarantees the website scalability. However, there are cases, where you might want to prevent creating a cached item of the page. For example, when a backend user is editing a page and they view it to observe the changes they’ve made, by default their request creates a cached version of the page, and this version is served to all users afterwards until the cache of the page expires. This behavior might be undesirable for two reasons:
- Administrators, and other backend users might prefer to always see the latest version of the page, for example if they are making changes to a widget template through code and want to see these changes immediately reflected. Thus, it’s better if pages are not cached for logged in users in this role.
- Administrators, and other backend users might have extended permissions to see content, which should not be seen by other roles or non-authenticated users browsing the site. If they create the cached version of the page by viewing it, then some content might be displayed to frontend
Select which logged in users should have output cache disabled
By default, Sitefinity CMS disables output cache for logged in users in the following scenarios:
- If you have Inline Editing enabled, users who have rights to perform Inline Editing have output cache disabled. By default, Inline editing is disabled for new projects, created with Sitefinity CMS versions 12.0 and later. For more information see Inline editing.
- Logged in users with Administrators role have output cache disabled.
You can customize the default behavior and manually configure the default set of roles, for which output cache is disabled. To do that, follow these steps:
- In your Sitefinity administrative backend navigate to Administration » Settings » Advanced
- From the treeview select Pages
- From the Pages advanced settings list, locate the Disable output cache for dropdown
- Select one of the following options:
- None – This option instructs Sitefinity CMS to always use output cache
- Administrators – this is the default value, and instruct Sitefinity CMS to disable output cache for logged in users in Administrators role
- BackendUsers – select this option to instruct Sitefinity CMS to disable output cache for all logged in users who can access the website backend
- Click Save changes