2 Replies Latest reply on Jan 28, 2008 10:28 AM by Stressed_Simon

    should I use caching or not?

      1. Is there any criteria when to use caching like say use caching if there are 5 cfincludes or custom tags in your code. Or something like use caching if code has more than 10 cfifs. I didn't find any article about it. or if .cfm file size is greater than say 30K.
      Data on my website is static for hour or so & good candidate for caching but I don't want to make code complecated if new developer comes & caching is not improving performance significantly.

      2. Also web page caching vs database query caching advantages of one method over other.

      Thank you.
        • 1. Re: should I use caching or not?
          Dan Bracuk Level 5
          If the data is only static for an hour, don't cache your query. Somebody is bound to get the cached version after the data has changed.

          • 2. should I use caching or not?
            Stressed_Simon Level 1
            The reason why there are not articles on this is that it is massively subjective. It is based on load and where the bottle necks are and how much dynamism is required.

            For example if your home page looks the same regardless of whether you are logged in or from a different location, etc. then you could cache it as HTML on a schedule and that will remove the need for ColdFusion to get involved at all for that page. However if this is not the case and you have lots of dynamic elements then you must look into alternatives, caching queries in variables gives you the most control, I personally do not like query caching handled by CF, but caching things in variables adds more management code. Here we have developed a Java library that can cache objects based on popularity and a timeout.

            As you can see it is entirely subjective and really is based on your current bottlenecks vs flexibility of your application.