0

I'm just applying some tag caching to templates on a client's site to improve performance (which isn't bad, but having no caching currently set could obviously be improved). I'm no expert at implementing caching in EE but I'm not seeing any reduction in database queries or in the memory used. So either I'm misunderstanding what I should be seeing, or I'm doing something wrong, or perhaps there is some setting that is preventing tag caching from taking place. (I'm aware of the disable_tag_caching config variable; mine is set to 'n').

Here's my testing process:

  1. Add cache="yes" refresh="720" parameters to a template's channel:entries tag
  2. turn on template debugger and output profiler via config variables
  3. Clear caches from the CP
  4. Load page template in front end, examine number of queries and memory used
  5. Reload page template, compare queries and memory usage to [4]

I would expect there to be a difference in the reported number of queries and, perhaps, the memory used, between stages 4 and 5, since -- as I understand it -- the content of the channel:entries tag will be generated by database queries in stage 4 but ought to be taken directly from the cache in stage 5. But I'm seeing the exact same numbers from both stages.

This really isn't a high traffic site at the moment, so I don't want to go down the road of buying a third party cache add-on if I can help it. I'd much prefer, at this stage, to understand either what I'm doing wrong (or misunderstanding) or, if my process is correct, what might be interfering with it.

Does anybody have any advice?

2 Answers 2

0

Rick, I guess after step 4 you change the parameter to cache="no" and just then do step 5. But you should not forget to clear the EE-cache before taking step 5, because possibly the entry-loop is still cached.

Also you should assure in your tests that the template you use is not cached as whole: go to Template-Manager, then preferences of your template, set "enable caching" to "no".

1
  • thanks for that. But we may have our wires crossed. I am expecting step 4 to give me query counts for the loading the template without caching, and step 5 to give me query counts for with caching (ie. figures for step 5 should be lower than for step 4). [3] ensures that [4] loads the template with no caching. By the end of [4] the template should have been cached, so [5] loads tag content from the cache. Emptying the cache before step 5 messes up the comparison test -- both [4] and [5] would be loading the template without caching. Lastly: none of my templates have page caching on.
    – RickL
    Commented Apr 14, 2015 at 8:39
0

Well... The reason I can think of is... Are the cache settings fine? Take a look at Control Panel > Admin > General Configuration > Caching Driver.

In case the cache driver being used is file, check if the cache directory is writable. Its default location is system/experessionengine/cache.

8
  • Hi Robson. Nope, I've already checked all that. Cache directory is writeable (permissions 777) and in fact I can see it being written to if I load a page (files being generated inside cache > default_site > tag_cache). Yet the template debugger/output profiler doesn't show any change in either the number of queries or the memory used when loading the page. And I get the same results on both local and production servers (I wondered if it was just a MAMP thing, but no).
    – RickL
    Commented Apr 21, 2015 at 8:46
  • Please, @RickLecoat. Try using page cache. Oh, one more thing! The template debugger should show some info about the cache.
    – Sobral
    Commented Apr 21, 2015 at 13:39
  • Page cache doesn't work for me, Robson; I have Stash passing various bits of dynamic information around the template and using the page cache option breaks that. Sorry.
    – RickL
    Commented Apr 22, 2015 at 8:38
  • No, @RickLecoat. I was asking you to enable page cache just for test. Enable it to make sure the cache is working.
    – Sobral
    Commented Apr 22, 2015 at 12:16
  • Robson: yep, cache is working (with page cache turned on for just the home page). Queries on first page load after emptying the cache: 29. Queries on subsequent page loads: 18. Memory usage also drops. If I clear the cache via the CP then queries return to 29 for the next page load only. So page cache works, but I'm not seeing any gains with tag caching. (I know that tag caching won't give the same gains as page caching, but there should be some).
    – RickL
    Commented Apr 23, 2015 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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