> I have a complex CFM template that output a result page after 
> a long process. The process includes: connecting to 3-4 different 
> datasources, string manipulation, math calculations, links, 
> includes, everything...
> 
> I though about the following way to cache: Every cfoutput (and 
> other html/js code) is stored incremently in a cf variable. (upon 
> successful completion of every phase).
> 
> In the end, I output the result to the user and store that 
> variable in a SQL table with a UID. Then, the second time a 
> user calls the CFM, I first check if the output content is 
> already in SQL, and output it. If the content is not there, or
> expired, I simply parse the CFM from the start.
> 
> Any comments on my way to do this?
> What is better in this way, store the output content in SQL 
> or a text file (and then <cfinclude> it)?

Ideally, you'll cache "as close to the client" as you can. So, if you get
the chance to build a static file, you could have the web server return that
static file, as opposed to caching data in the CF server's memory. In the
same vein, retrieving data from the CF server's memory will be more
efficient than retrieving it from the database. The best performance of all,
of course, is to store data on the client, which is why browsers cache data.

In your case, you probably would be better served by caching output within
CF rather than within the database. You might take a look at the CFCACHE
tag, which will store the generated content as a text file on the server.
Even better than that (better from a performance standpoint, anyway), you
could actually generate an HTML file on a regular basis (using CFFILE), and
simply have that returned by the web server.

The price, of course, for this better performance is that your site becomes
less dynamic and more static, so you have to carefully decide what you can
afford to make static, and apply caching appropriately.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to