Skip to content
Menu
Search
Browse documentation & this page

Developer Guide

How pages are cached

What Cendia remembers between page views, how quickly a publish shows, and what to know when you run more than one server or put a CDN in front.

Cendia remembers the data a page is made from, and runs your template for every request. It does not cache the finished HTML.

The short version: there is nothing to set up. A publish shows on the next request, and everything that makes a page personal keeps working. Read on if you run several servers, use a CDN, or want to tune it.

What is remembered

For each URL, Cendia keeps what it resolved to: the page, its published version and settings, the blocks in its zones, and the links and images it points at. It also keeps three small lists every page needs: websites and host names, audiences, and the installed license.

None of that depends on who is asking, so the next visitor's page is drawn without reading it again. A repeat page view makes about two database round trips, down from about twenty-four, and both are the visitor's own (recording the visit, and counting visits for an audience that asks).

What still happens on every request

  • Your Razor template runs, with fresh models.
  • Audiences are evaluated, so personalized regions and zone placements are right for this visitor.
  • The visit is recorded, when visitor tracking is on.
  • Forms get their one-time values.
  • A restricted page checks the real visitor's access rights.
  • Expiration and publish dates are compared with the clock, so a page comes down at its moment.

How quickly a change shows

Change Shows
A publish, move, rename, trash, access right or setting saved on this server On the next request.
The same change saved on another server behind your load balancer Within 60 seconds on the others.
A page reaching its expiration or publish date At that moment.
A draft being saved Never affects visitors, and does not clear anything.

Settings

"Cendia": {
  "PageCacheSeconds": 60
}

PageCacheSeconds is how long an entry is used before the database is asked again. With one server you will not notice it, because a save clears the cache at once. With several, it is the longest a change made on one server can go unseen on another. Set it to 0 to turn the cache off.

Nothing runs in the background for this: no timer and no warm-up. An entry is loaded by the request that needs it.

Browsers and CDNs

Every rendered page is sent with Cache-Control: private, no-cache. A page is drawn for one visitor, so a CDN must not keep it and hand it to the next one.

If you know a page is the same for every visitor (no audiences, no form, and visitor tracking off or not needed on it), set your own header in the page's handler:

public class LandingPageModel : CmsPageModel<LandingPage>
{
    public void OnGet() =>
        Response.Headers.CacheControl = "public, max-age=60";
}

Your header wins. Remember that a CDN serving the page means Cendia does not see the request: the visit is not recorded and audiences are not evaluated.

To purge a CDN when content changes, subscribe it to content.published, content.unpublished and content.moved. See Webhooks.

Troubleshooting

What you see Likely cause
A publish takes up to a minute to appear You have more than one server; the others wait for PageCacheSeconds. Lower it if a minute is too long.
A change made directly in the database does not appear Only saves made through Cendia clear the cache. Wait for PageCacheSeconds, or restart.
Memory grows after a crawl Addresses that resolve to nothing are remembered too. The cache is dropped whole at 50,000 entries.