> How is caching the query different from saving it as a 
> session variable? Both are kept in memory, right? Except 
> that the cached one will get bumped if memory is needed?

Query caching is different in several ways.

1. It uses the CFQUERY attributes and the actual SQL statement within the
CFQUERY tags to determine whether a recordset will be reused from the cache
or retrieved from the database. If the attributes or SQL are different, the
database will be queried. If you store a recordset in a persistent memory
variable (Session, Application, Server) then reference that variable, you'll
always get the original recordset, unless you write code to rebuild its
contents yourself.

2. It's very easy to retrofit query caching into an existing application,
while the use of memory variables for query caching is a bit harder to add
after the fact. Query caching is easier in general.

Also, cached queries will not be bumped from memory except by other cached
queries, based on the maximum number of cached queries the server is
configured to allow.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to