[thelist] CF: Clearing a cached query?

Morgan Kelsey morgan at morgankelsey.com
Thu Oct 10 20:17:01 CDT 2002


Frank,

I do something like this in my Application template:

 <cfscript>
 querycache = CreateTimeSpan(0,0,30,0);

 if(structKeyExists(url,"querycache") AND url.querycache eq 'flush')
    querycache = CreateTimeSpan(0,0,0,0);
</cfscript>

set a variable to the regular cache value, create an if that is triggered by
an incoming url variable, like
yoursite.com?querycache=flush
if the url.querycache value exists, and is "flush" set the querycache to 0.

then use app.querycache in your query tags:

<cfquery [...] cachedwithin="#querycache#">


good luck,

nagrom


>
> <!--- A cached query --->
> <cfquery [...] cachedwithin="#CreateTimeSpan(0,0,30,0)#">
>
> </cfquery>
>
> I'm using the CachedWithin attribute for some queries that
> are rarely updated. I'd like to be able to flush the cache
> when the admin updates updates a record. The query is on
> made on the user side, the update is a completely unrelated
> process.
>
> I've looked at cfflush and cfcache, and don't quite 'get'
> how to use them in this particular situation. Can someone
> suggest a method?
>
> Thanks.
>
>
> --
> Frank Marion
> Tel. 416 825 7488
> framar at interlog.com
> http://www.frankmarion.com
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list