Caching Content

Salesforce B2C Commerce uses two caches for different kinds of content, each of which can be configured and invalidated separately.:

See Configuring Cache.

Using page caching can improve your site's overall performance and can minimize customer wait times. Web content is cached by the web server to improve response times. Requested pages are stored in the cache and can be presented immediately upon request. You can use caching on portions of pages, which enables you to manage the customer experience while satisfying business requirements related to data changes like pricing and promotions.

B2C Commerce supports the cross-site sharing of static files. You can configure Time-To-Live (TTL) for this globally cached static content.

Adding ISML Tags to Templates

For a page on your storefront to be cached, you must add the ISML tag <iscache> to the appropriate template. The tag can be located anywhere in the template. If the <iscache> tag occurs several times in a template, the <iscache> tag with the lowest cache settings (either minimal cache duration or status=”off”), including all local template includes, determines the caching behavior of the resulting page.

When including other templates in a template, make sure that the included template doesn't contain an <iscache> tag which is in conflict with your original settings.


<iscache type = "relative" hour = "24">
Note: If the page caching preference isn't enabled in Business Manager, the <iscache> tag is ignored when it's encountered in a template.

Page Caching Best Practices

  1. Caching is controlled on a per page basis, via the ISML template for the page.
  2. Caching duration is specified in the page, typically 24 hours.
  3. Frequently changing pages benefit from a shorter caching period.
  4. Stored pages are only invalidated and a new one pulled from the Application Server if any of the following happen:
    • the defined caching time is exceeded
    • a replication is performed
    • an explicit page cache invalidation is triggered by the merchant in Business Manager
  5. Disable page caching on Sandboxes and Staging instances in order to see changes immediately.
  6. Portions of pages can be cached separately. You can assemble a page from snippets with different caching attributes using remote includes. Each part:
    • has to be a result of a pipeline request to the application server
    • is included using the <isinclude url=""> syntax
    • can have different or no caching tags
    • all sections are assembled by Web Adapter and responded to client
  7. In general, don't cache pages that show buyer or session information.
  8. If you see certain trends in analytic data, you might decide to alter the time length for caching of static content.
  9. If you have a specific type of error in production, you might need to invalidate caching briefly to do a hot fix.

Related Links

Page Cache and Replication

Create a Page Cache Partition

Invalidate a Page Cache Partition