Cert++
Close

Setting page cache expiration from SFRA controllers

Key Takeaway

In an SFRA controller, set page cache time with a cache decorator or with response.setExpires(), not with the <iscache> tag. Pass setExpires the current time in milliseconds plus a duration. In an if/else chain of checks, the first true condition picks that duration.

Page caching stores a complete server response at the web server layer, so repeat requests for the same URL skip the application and storage layers. In an SFRA controller, you decide how long a response stays in the page cache. You either add a cache decorator to the route or call response.setExpires(), instead of using the older <iscache> ISML tag.

Where the page cache sits

The page cache sits in the web server layer, which is the top layer of the platform. A request served from the page cache creates no load on the application or storage layers.

The page cache is enabled per site in Business Manager, with the "Enable Page Caching" setting on the site's "Cache" tab. In production, the page cache is always on and can't be disabled.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given a problem or performance issue and data, use relevant tools to inspect code performance and determine and implement solutions (cache configuration, profilers, etc.) to resolve this issue

0/11

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.