Configure Dispatcher cache invalidation scope with statfileslevel in AEM
This article explains how to use the Dispatcher /statfileslevel setting to separate cache invalidation for independent site subtrees, such as /content/siteA and /content/siteB. The setting is measured from the cache docroot, not directly from the AEM repository root. To address this, map the site paths to the Dispatcher cache directory, set the level at the intended site boundary, and test an invalidation under one site.
Description description
Environment
Adobe Experience Manager Dispatcher (all versions)
Issue/Symptoms
- When content under one site subtree is published, you want to invalidate that site’s cached content without invalidating an independent sibling site subtree.
- The desired scope depends on the relationship between repository paths and the Dispatcher cache directory under
docroot.
Cause
Dispatcher uses /statfileslevel to control where it creates .stat files under the cache docroot. The docroot is level 0. During invalidation, Dispatcher touches .stat files along the path to the invalidated resource, up to the configured level or the resource’s directory depth, whichever is lower. Cached resources are checked against the nearest applicable .stat file. A level that’s too low can leave sites sharing a higher-level invalidation domain; set the level based on the actual cache directory structure and the boundary of the independent site subtree.
Resolution resolution
Follow the steps below to address the issue:
- Review the Dispatcher farm configuration under
/cacheand locate/statfileslevel. - Map the AEM content paths to their corresponding directories in the Dispatcher cache. Identify the configured cache
docroot, which is level0, and count the directory levels below it. If the cache structure is<docroot>/content/siteAand<docroot>/content/siteB, then/contentis level1and each site root is level2. - Set
/statfileslevelto the level of the intended invalidation boundary. For the example above,/statfileslevel "2"places a.statfile at each site root. Publishing content under/content/siteAtouches the.statfiles along that path; an independent/content/siteBsubtree uses its own site-root.statfile and isn’t invalidated by that change. Note: A higher value doesn’t inherently broaden invalidation. It allows.statfiles to be placed deeper in the cache tree, creating more granular invalidation domains where the directory structure supports them. Each invalidation also touches the.statfiles along the path up to the configured level. Use this separation only when the site trees are independent; account for shared or cross-site content references in the invalidation design. - After changing the configuration, publish a test change under one site subtree. Verify that the updated site content is invalidated and that an independent sibling site subtree isn’t unnecessarily invalidated.