1

I have a template that displays 1,100 entries as dots on a zoomable/searchable map. The query is cached and it performs beautifully. As expected, if I edit any of those entries the cache is busted and the next page load lags.

What I prefer to do is have the cache rebuilt once per day via a cron job or some other method.

For starters, I added

'cacheElementQueries' => false,

to my general config. I thought this prevents automatic cache busting, but it does not seem to. If I edit an entry, the cache is still being rebuilt (or so I assume by the page load time).

Any help on what I'm not understanding? Thanks in advance.

2

cacheElementQueries set to false should cause the behavior you're looking for. i.e. Craft no longer keeps track of element queries inside of the cache tag for use in when deciding when to bust them.

Might also be worth looking at the Cache Flag plugin as that lets you more explicitly define when you'd like caches to be busted.

| improve this answer | |
  • Hmm, not sure why, but with cacheElementQueries set to false I'm still seeing a load lag after I edit one of the related entries to my query. Would '{% cache unless .... %}' be affecting anything? – Mosswalker May 22 at 18:30
  • What I found: even with cacheElementQueries set to FALSE the cache will be busted when an entry is edited if {% cache *unless* .... %} is used in the cache statement. Maybe that makes sense, but I'm just working around it by changing the query so I do not need the cache unless – Mosswalker May 27 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.