[thelist] CF: Clearing a cached query?

Joshua Olson joshua at waetech.com
Tue Oct 15 12:42:01 CDT 2002

----- Original Message -----
From: "rudy" <r937 at interlog.com>
Sent: Tuesday, October 15, 2002 12:40 PM

> > BUT, i still find, that if i have more than one template accessing a
> > query, there's probably a better way to do it that only needs to run
> > the query once.
> okay, here's my example
> <CFQUERY NAME="navquery" DATASOURCE="#blogdsn#"
>    CACHEDWITHIN="#CreateTimeSpan(0,1,0,0)#"
>    BLOCKFACTOR="100" >


> the purpose of this query is to get my site's navigation structure
> this query is called on every page in my site


Here's what I would suggest--create a routine to do the query and push the
data to disk in a manner that can be quickly read by CF. Writing out CF code
to be cfincluded later would be my suggestion.  The file should be nothing
more than a bunch of cfsets, such as:

<cfset nav = ArrayNew(1)>
<cfset nav[1] = StructNew()>
<cfset nav[1].title = "title1">
<cfset nav[1].href = "href1">

Then, cfinclude this file within application.cfm.  Any time that the
navigation changes, rerun the code that generates the file.  It'll be real
quick on the front end.


More information about the thelist mailing list