Bridgeline Digital Logo
Menu

Caching in OrchestraCMS

OrchestraCMS maintains a caching layer of pre-rendered pages and content to improve performance. The cache entries are automatically generated and used by OrchestraCMS depending on flags on content and page templates. Developers will not touch the cache directly, but should be aware of the performance implications of disabling caching flags. These caches are created when a page or content item is published.  Since the cache captures the state of the item at publish, it is important to plan your code and caching settings to accommodate for what should and should not be captured statically.  For example, code that renders the current user's name at runtime will store that user's name in the captured cache file; and that is the name any visitor would see when viewing the item.  However, if the code captured some JavaScript that renders the current user's name, the value viewed by a visitor will be the username relevant to their session.

 
Any references to page caching presumes the solution in question is using OrchestraCMS to serve the pages to visitors.  OrchestraCMS can provide content services independent of any site or page management.  In these instances, since OrchestraCMS is not managing the pages, any page caching settings in OrchestraCMS would have no effect on the solution.  Examples of this situation may include mobile apps (not sites), third party site platforms or native Salesforce Lightning Communities.

Cache Types

L1 Content Cache

OrchestraCMS will create an L1 content cache for content templates with the isContentCacheable option checked. This is the most common type of content cache, since most content templates are content cacheable. This flag should not be used when:

  • A content template has page-specific properties (i.e. a Breadcrumb's active item is page-specific)
  • A content template directly queries Salesforce data or outputs session or user-specific markup in its generate class

L2 Content Cache

OrchestraCMS will create an L2 content cache for content templates with the isPageCacheable option checked and the isContentCacheable option unchecked. This flag should not be used when:

  • A content template directly queries Salesforce data or outputs session or user-specific markup in its generate class

Page Caching

OrchestraCMS will create a page cache for page templates with the Page Caching Enabled option checked. Whenever possible a cached page will include rendered content. Notable exceptions where a page cache will not include rendered content are:

  • The content template is not cacheable (isPageCacheable is unchecked)
  • The piece of content is targeted
  • Private sharing is enabled and the item is not shared with all users

Any content that cannot be included in a page cache will be dynamically loaded with an AJAX call once the page has loaded in a browser.  Until the markup is inserted in the DOM by OrchestraCMS, a placeholder is used in the form of a dynamic load token.  This will impact jQuery in that the markup for the content items that are not in the page cache will not be present in the DOM at the $(document).ready event.  OrchestraCMS provides a $(document).ocmsDynamicLoadFinished event that can be used with jQuery in place of any $(document).ready functions impacting OrchestraCMS content.

Caching Considerations

Cache Refresh

OrchestraCMS does not track changes to the Visualforce page or Apex controller underlying a page or content template. After making code changes in an org, the OrchestraCMS caches may contain stale renderings. There are three ways to force a cache refresh for pages or content items.

  1. Site-wide cache refresh
    • For pages, under OrchestraCMS Setup | Cache | Page, click the Refresh Cache button.
    • For content items, under OrchestraCMS Setup | Cache | Content, click Refresh for both the L1 Cache Level followed by Refresh next to the L2 Cache Level. Note that you must refresh the L1 and L2 content caches separately and both must be refreshed.
  2. Bulk cache refresh
    • For pages, under the Manage Site | Pages tab, select several published pages. Click the Refresh Cache button in the Actions panel .
    • For content items, under the Manage Site | Content tab, select several published content items. Click the Refresh Cache button in the Actions panel.
  3. Single-item cache refresh
    • To refresh a single page's cache, open its edit page within OrchestraCMS. Click the Refresh Cache button in the Actions panel.
    • To refresh a single content item's cache, open its edit page within OrchestraCMS. Expand the More Actions section in the Actions panel and click the Refresh Cache button.

Preview Mode

In preview mode, OrchestraCMS will not utilize caches for any unpublished pages or content, regardless of the cache settings on their respective templates. If a page mixes published and unpublished content, OrchestraCMS will use content caches when rendering the published content.