If you change the query in any way, it will rerun, so you can do a
couple things...

One of the most interesting would be to make the CACHEDWITHIN value a
variable, set in the Application.cfm, but updatable through the url. 
So, when you wanted to "flush" the cache, you could call the page with a
url ?cache=flush, and your code would set the value of the CACHEDWITHIN
to 0.  Next run without the url variable would recache it back up.

<CFQUERY NAME="..." DATASOURCE="..." CACHEDWITHIN="#CacheValue#">
....
</CFQUERY>

Application.cfm:

<CFIF IsDefined("URL.CACHE") AND URL.Cache eq "flush">
        <CFSET CacheValue = CreateTimeSpan(0,0,0,0)>
<CFELSE>
        <CFSET CacheValue = CreateTimeSpan(0,1,0,0)>
        <!--- or whatever your normal cache value is --->
</CFIF>

Think this might work?

"Al Musella, DPM" wrote:
> 
>    I make extensive use of cached queries on 1 of my websites, that uses
> read-only data that gets updated once a week..
> 
> the problem is that when I update that database, I want to clear the cache
> so the new data is used.. sometimes the cached querry presents a record
> that is no longer available, and when you click to get the details - the
> record is no longer there, so it generates an error.
> 
> So - how do you clear the cache? Hopefully with cfcode without having to
> restart the CF server?
> 
> Al Musella, DPM
> A1webs.com
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to