ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Template caching: when not to do it

July 18, 2007 12:57pm

Subscribe [2]
  • #1 / Jul 18, 2007 12:57pm

    Richard Frank

    200 posts

    Hi

    I’ve just launched a new website: http://www.nelsonmandela.org

    I’ve turned on template caching (10 min) for the front page, which reduced the queries from 64 to 14 and greatly sped up the page generation.

    The front page does have random images and a random quote, but I don’t mind if these change once every 10 minutes.

    Now I’m wondering why don’t I run template caching on every page.

    Could someone briefly explain under which circumstances template caching should not be turned on?

    The website probably has one or two updates a day - either in news or publications. Some things are randomised, but I don’t mind if they change once every half an hour, etc. The randomness is not for every user, it’s just to change the website without me having to manually do it.

  • #2 / Jul 18, 2007 2:17pm

    Lisa Wess

    20502 posts

    First, have a read through the docs on caching there are notes there regarding caching that are important.

    Second, are you delivering any particular content based on member_group conditionals or the like?  Those would be your main concern.

  • #3 / Jul 18, 2007 3:34pm

    Richard Frank

    200 posts

    Have read the docs. The template caching section appears a bit thin…

    I don’t have member_group conditionals.

    What is “the like”? I do have conditionals, but they’re based on whether content in a weblog exists or not, or if count < 5, etc. Nothing based on a user’s session or preferences.

    I do have weblog entries with expiration and future-dating, but if they appear half an hour later (30 min cache), I don’t mind.

    Is the content that displays on the template cached? If I add or change a weblog entry, will it reflect immediately on the front-end?

  • #4 / Jul 18, 2007 3:36pm

    Lisa Wess

    20502 posts

    Richard, “the like” just includes other member based conditionals, if member_id, group_id, etc.  There are quite a few.

    The query caching is different from template caching, so if you are using future-posting, make sure that option is off.

    Yes, updating or adding weblog entry or template forces the cache to update, and you can always force an update in Admin -> Utilities -> Clear cached files.  Your usage seems fine, though.  You can always check by running EE in two different browsers, and refresh the pages, to see what happens.

  • #5 / Aug 24, 2007 8:27am

    kenny2

    90 posts

    Hi Lisa,
    - if I turn on template caching and leave the interval at 0 is this the same as turning page caching off?
    - if I set template caching to say 60 for each of my templates does this mean the cache of all templates will be updated at the same time?
    - is this cache help on a visitors pooter or on my server?

    cheers kenny

  • #6 / Aug 24, 2007 12:47pm

    Lisa Wess

    20502 posts

    kenny -

    1) Not really, and why would you do that?
    2) No, not necessarily.  That’s the interval, but the cache clearing is triggered by a page view. 
    3) This is to help on your server; the browser cache is for the visitor’s computer.

  • #7 / Aug 24, 2007 12:54pm

    kenny2

    90 posts

    thanks Lisa,
    1) well I wouldnt want to do that, I was just curious
    2 & 3) ok so the page is cached on the visitors computer not on the server

    cheers kenny

  • #8 / Aug 24, 2007 12:57pm

    Lisa Wess

    20502 posts

    No.

    2. EE’s cache is held on the host server, EE can not write to a visitor’s computer, except in the form of a cookie.  That is how browsers work. =)

    There are two caches, well there can be many more, but two main ones:

    1) EE’s cache, held in /system/cache/
    2) The browser cache, held on the visitor’s computer, and caches much different information than EE’s cache does.

  • #9 / Aug 24, 2007 1:06pm

    kenny2

    90 posts

    ah thats where i was getting confused about the time to trigger the update to the template cache. I was thinking the cache would be updated at the defined interval regardless of wether a person loaded the page. I was wondering if it is best to stagger the intervals so not all pages are re cached at the same time.

  • #10 / Aug 24, 2007 1:36pm

    Lisa Wess

    20502 posts

    EE needs some form of “trigger” to do actions - usually this means someone visiting that template. =)

  • #11 / Aug 25, 2007 5:59am

    Richard Frank

    200 posts

    When I update a template it doesn’t automatically reflect on the frontend, because of the caching. Surely EE should recognise an updated template and automatically re-cache it?

  • #12 / Aug 26, 2007 11:47am

    Robin Sowell

    13255 posts

    Saving a template should also clear caches.  I’m wondering if anything is ‘off’ in your cache clearing.  FTP in- go to system/cache.  See if you’ve got some files in each of the folders in there- and what folders do you have?  Then go to ‘Admin- Utilities’- clear all caches.  If you check now via ftp- being sure to refresh- are those folders now empty?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases