This is why I tend to "cache" queries by putting them into application and session
scope. It gives me much more granular control over when something changes. The
downside is dealing with locks.
<cfquery name="getStuff" datasource="DSNname">
SELECT stuff
FROM table
</cfquery>
<cflock scope="APPLICATION" type="exclusive" timeout="10">
<cfset APPLICATION.getStuff = duplicate(getStuff)>
</cflock>
Then in the application.cfm, I'll copy it to REQUEST scope for ease of use:
<cflock scope="APPLICATION" type="readonly" timeout="10">
<cfset REQUEST.getStuff = duplicate(APPLICATION.getStuff)>
</cflock>
For output:
<cfoutput query="#REQUEST.getStuff">
#stuff#
</cfoutput>
Although, I'm far more likely to put commonly accessed information into structures,
but I'm a bit of a structure freak that way.
Sharon
----- Original Message -----
From: "FARRAH NG" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, March 13, 2002 4:33 PM
Subject: cached query
> hi all,
> i have built a website for a client where the home page is totally
> dynamics ( the cfm file has almost 10 queries accessing 10 different
> tables in order to populate the page). Now the client is complaining
> about the slow load time. they told me they don't need to have the
> home page accessing the database everytime the page is loaded since a
> lot of the info in the page is not changed that frequently. I am
> thinking of using the CACHEDWITHIN with some of the CFQUERY in the
> page, like CACHEDWITHIN 2 days. What i am worrying about is if the
> client update the data within those 2 days, the home page will not
> be able to display the lastest info. Is there a way to refresh all
> the cached query once the client update the database, so all the
> cached queries will also be updated instantly without waiting for the
> CACHEDWITHIN to expire.
>
> Anyone has any idea is very welcomed to suggest.
>
> thank
>
>
>
> --------------------------------------------------------------------------
> Global Internet phone calls, voicemail, fax, e-mail and instant messaging.
> Sign-up today at http://www.hotvoice.com
>
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
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