AEM Dispatcher cache invalidation with statfileslevel and gracePeriod
When you configure Adobe Experience Manager (AEM) Dispatcher with statfileslevel and gracePeriod, explicit cache clearing for listing pages is generally unnecessary if the listing and the updated content are under the same .stat file scope. Verify your statfileslevel setting to confirm both are covered.
Description description
Symptoms
Customer asks whether explicit cache clearing (invalidation type INVALIDATE) is needed for listing pages after content is updated with type ADD. With /publishfarm/cache/statfileslevel "2" and /publishfarm/cache/gracePeriod "2", listing pages appear to refresh without it.
Steps to reproduce
- Configure
/publishfarm/cache/statfileslevel "2"and/publishfarm/cache/gracePeriod "2". - Invalidate a file under
.statwith typeADD. The.statfile’s modification date updates. - Request a file matching
/invalidate/../type "allow"within 2 seconds. Result:actionhit, cache unchanged. - Request it again after 2 seconds. Result:
actionmiss, cache refreshed.
Cause
ADD updates the .stat file’s timestamp. Files matching allow rules are treated as invalid only after gracePeriod has elapsed since that timestamp. When the updated content and the listing page share the same .stat scope, the listing is invalidated by the same mechanism, so a separate INVALIDATE is unnecessary.
Resolution resolution
Follow the steps below to resolve the issue:
- Understand
statfileslevelandgracePeriodbehavior: Wheninvalidate.cacheis triggered (for example, by publishing a page), Dispatcher creates or updates the.statfile at the configuredstatfileslevel. - On the next request for a cached page, Dispatcher compares the timestamps of the
.statfile and the cached file. If the.statfile is newer, the cache is invalidated and content is fetched from Publish. - The
gracePeriodsetting (for example, 2 seconds) delays cache invalidation for the specified duration after the.statfile is updated. Requests within thegracePeriodreturn the cached content (actionhit). After thegracePeriod, the cache is invalidated (actionmiss). - If your configuration triggers
invalidate.cacheon publishing a page, and both the updated content and its listing are under the same.statfile scope, explicit cache clearing for the listing page is generally unnecessary. The listing will be invalidated automatically after thegracePeriod. - Ensure that the
statfileslevelsetting covers both the updated content and the listing page under the same.statfile. - Monitor logs for edge cases where
invalidate.cacheis triggered continuously, as cache invalidation timing may shift. AdjustgracePeriodas needed.
Verify that cache invalidation occurs as expected after the gracePeriod and that explicit INVALIDATE operations are not required for listing pages under the same .stat file scope.