1

I've been playing around with the caching settings on my EE site. I'm getting really good server response times and the getting the number of queries right down which is perfect.

I've always avoided caching due to content 'being out of date', but I realise if you have the config value 'new_posts_clear_caches' set to 'y' then each time there is a new post or one gets edited or a new comment is added then the cache is cleared.

My question is about the cache expiry times. I've been defaulting to 60 mins but now I'm thinking that if the cache is cleared when new content is posted then why not set this much higher - 24 hours or so? Is there a downside to this?

I have some tags which really don't need updating much at all - category lists for example.

Obviously, I'm not caching any parts which vary based on member login etc...

What do people set their cache times to?

3

I personally think the ideal is that each page is cached non-stop until the content or template changes. This is possible with add-ons like Causing Effect CE Cache, which is great for high-performance / high-load sites. On these sites, pages can be cached for days and months without being refreshed.

When I use only the built-in EE caching, I tend to set the cache refresh time to be 60 - 180 minutes. It's arbitrary--long enough to help performance, but short enough that site content managers can always trust that their changes will go live that day.

But I think it's fine to set a much longer cache expiration time--especially if the site content managers understand how the cache works.

There's a famous saying that cache invalidation is one of the two hard problems in computer science. And, for EE--both with its native caching, and with add-ons like CE Cache and Solspace Static Page Caching, the reality is that sometimes the cache expiration for a particular page / template doesn't happen as expected.

So imho the one reason to set shorter cache durations is for EE to have more chances at refreshing pages / templates in any period, because it may fail to refresh the cache in one way or another at any given moment. But this is a little issue, or a non-issue, if the content manager knows how to recognize whether a change has gone "live," and also then is comfortable manually refreshing the cache when needed.

| improve this answer | |
  • I'm not going to worry about the cache not refreshing. And as you say we can manually clear the cache through the admin anyway. I'm going to set the cache time to a couple of days and see how it goes - the number of database queries (and therefore server load) would be considerable. Out of interest why 60-180mins for EE cache and longer for CE Cache? – Garth Feb 18 '14 at 13:29
  • Mostly it's because I adopted the 60-180 cache practice about 10 years ago, and never had an issues with it--until I did, and found that increasing the time didn't really address the issues (in those cases), and then started using Static Page Caching with EE 1 and CE Cache with EE 2. But I'd say: as long as the native EE cache gets you the performance you want, it's better to use as long as cache times as you can, to the degree that refreshing the cache has no advantage for you. And I'd go for much longer times than 60-180 minutes were I using the native EE cache on a new site, now. – Jay F Feb 19 '14 at 2:48
1

It's been long enough now that I don't remember the details, but I had a conversation with Nevin of Engine Hosting and his recommendation was 10 minutes max. Maybe a conversation with someone from your hosting environment is in order.

| improve this answer | |
  • 10 mins seems pretty low, unless it's a high traffic site. For a 'standard' site there probably aren't that many page requests in 10 mins to be a whole lot of benefit. Also worth pointing out that the caching is not just for server load on high traffic sites but the difference in page load times for any EE site. – Garth Feb 18 '14 at 13:41

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.