[thelist] CF: Clearing a cached query?

Raymond Camden jedimaster at macromedia.com
Fri Oct 11 07:22:01 CDT 2002


In order to clear a cached query, you simply rerun the query with a
timespan cache of 0,0,0,0.

HOWEVER...

The query must be the EXACT same SQL. In other words, if the original
query looked like so:

	select * from foo

and your code to clear the cache looks like so:

select * from foo

you will NOT be able to clear the cache? Why? Because the white space
has changed.

A simple way to get around this is to take your query and place it in
either a custom tag, UDF, or CFC. Add an option that specifies the
timeout. That way no matter how you use the query (public side or
admin), the SQL will remain the same and you won't have to worry.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Hire

Email    : jedimaster at macromedia.com
WWW      : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org] On Behalf Of Frank
> Sent: Thursday, October 10, 2002 8:20 PM
> To: Evolt
> Subject: [thelist] CF: Clearing a cached query?
>
>
>
> <!--- 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