Static and Page Cache
B2C Commerce uses two caches for different kinds of content, each of which can be configured and invalidated separately.
- Static content cache: used to cache images, icons, CSS style sheets, and other non-dynamic assets.
- Page Cache: used to cache HTML pages generated from ISML templates
when
<iscache>
is enabled.
Using page caching can improve your site's overall performance and can minimize customer wait times. The web server caches content 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 that is in conflict
with your original settings.
Examples
<iscache type = "relative" hour = "24">
<iscache>
tag is ignored when
it's encountered in a template.Page Caching Best Practices
- Caching is controlled on a per page basis, via the ISML template for the page.
- Caching duration is specified in the page, typically 24 hours.
- Frequently changing pages benefit from a shorter caching period.
- 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
- the merchant triggers an explicit page cache invalidation in Business Manager
- To see changes immediately, disable page caching on Sandboxes and Staging instances.
- 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
- In general, don't cache pages that show buyer or session information.
- If you see certain trends in analytic data, you might decide to alter the time length for caching of static content.
- If you have a specific type of error in production, you might need to invalidate caching briefly to do a hot fix.