View Single Post
  #45 (permalink)  
Old 02-21-2008, 01:43 AM
prasannavigneshr prasannavigneshr is offline
D-Web Incredible
 
Join Date: Feb 2007
Posts: 1,321
prasannavigneshr is on a distinguished road
Send a message via MSN to prasannavigneshr
Thumbs up ColdFusion Tips & Tricks - Query Caching

Query Caching


If you do not have a version of Cold Fusion that supports query caching, you can use an application variable for the query name and the query will always be available in memory. I have an example in the accompanied HTML/CFML code block below that you can use to model your query after. Put this in your application.cfm so that the query will always be available to any programs that need it. To reference the application query, simply use the application variable name. Just remember, queries such as these should be relativly small as they will be consuming system resources.

Example HTML/CFML code:


Code:
<CFIF IsDefiend("application.MyQuery") EQUAL "No">
  <CFQUERY name="application.MyQuery" .....>
    SELECT *
    FROM MyTable
  </CFQUERY>
</CFIF>

....

<CFLOOP query="application.MyQuery")>
  ...
</CFLOOP>
__________________
Prasanna Vignesh
MCPD | Web Developer
Reply With Quote