Caching problem with calculated state depending on date

Hello, I have a problem with the caching system in modx (current version, PHP 7.4 …) and it seems I don’t understand it right.


  • Start page with a list of dates for courses
  • each course has a mark like “free places”, “fully booked”, “course is running” or “today”
  • “running” and “today” are calculated by comparative calculation of first day and current date
  • calling the site on a day with a “today” course doesn’t show the “today” mark
  • my problem is probably the caching of page and/or snippets


Start page is cached. (I can put them uncached but I want an acceptable TTFB if possible.)

The template of the start page contains a pdoResources call uncached
[[!pdoResources? …]]

The template of the pdoResource contains among other things this:
[[+termintag1:date=`%Y%m%d`:is=`[[getDate:date=`%Y%m%d`]]`:then=`<mark>Heute</mark>`]] [[+termintag1:date=`%Y%m%d`:lt=`[[getDate:date=`%Y%m%d`]]`:then=`<mark>Kurs läuft</mark>`]]

I need a hint what to do for a correct display of states on start page with every request. Yesterday I will see the “free places” (not shown in the code above), today I will see the “today” (Heute) and tomorrow there should be a “running” (Kurs läuft) mark.

Currently it doesn’t work, today I see free places and not the “today” mark.

Ok, tested setting the start page uncached: doesn’t change the TTFB.
But what is the correct setting for cached/uncached elements?

Have you tried also calling the getDate uncached?

... [[!getDate:date=`%Y%m%d`]] ...
1 Like

Don’t tried this yet … should the page itself be cached or uncached? The listing call with pdoResources will be left uncached furthermore.

Tried it with uncached getDate. It looks like that is the solution.
Page itself can be cached, but the xFPC plugin can’t be used.

Will give them a look tomorow (with real data), if it works then it’s solved.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.