Skip to Content

How Cache Works in AEM

The AEM Cache layer is handled by the dispatcher instances. These hold static pages temporarily stored on the specialized apache web-servers. A cached page will be stored until the system invalidates it. After a cached page is invalidated, upon a subsequent request the page will be rendered anew. Cached pages are invalidated when...

  • the page itself is activated

  • or a child page is activated (upto and including the department homepage)

It’s pretty easy to understand the first case. Simply, a cached page is invalidated when that page is activated from author. 

The second case (when the a child page is activated) could use more explanation. It's called folder level invalidation. Consider this tree...

/content

    /michigan-lsa

        /department

            /en

                sub1/

                sub2/

                    sub2-a/

                    sub2-b/

The department homepage path is /content/michigan-lsa/department/en.html

Technical Note: In the dispatchers view, the homepage is considered level 4 where the document root (/) is 0. Since we are configured for "statfileslevel=4," then cache at levels lower than 4 are not affected by level 4 and higher activations. In other words, cache invalidation works it's way up the tree until it finds the department homepage.  

Activation & Cache Invalidation
When this page is activated Then these cached pages are invalidated
/content/michigan-lsa/department/en /content/michigan-lsa/department/en
/content/michigan-lsa/department/en/sub1

/content/michigan-lsa/department/en

/content/michigan-lsa/department/en/sub1

/content/michigan-lsa/department/en/sub2/sub2-b

/content/michigan-lsa/department/en

/content/michigan-lsa/department/en/sub2

/content/michigan-lsa/department/en/sub2/sub2-b

Tip: One practical take-away for this regards the Event list shown on the homepage. This content is cached along with the rest of the homepage. As time passes, the cache could show outdated events. Editors can invalidate the homepage cache by activating any subpage within the department website.

As the table illustrates, activating a department subpage will invalidate cache on that page's parents upto and including the homepage. If you find that the News & Events page (/content/michigan-lsa/dept/en/news-events) is outdated, then adding or changing a department news subpage will have a similar effect.

As shown here, the homepage was last activated on 10/28/2015. Yet the screenshot taken on 11/3/2015 shows only upcoming events on the homepage. This is the case because subpage content was activated, and in doing so the homepage cache was automatically refreshed.

Cache Flowchart from Adobe
This image is from Adobe's Docs at https://docs.adobe.com/docs/en/dispatcher.html#How%20Dispatcher%20performs%20Caching