On 2/6/01, Willy Ray penned:
>Is there any way to check to see if a Query is cached or not, before
>I call it? I have some big'uns, and I'd like to be able to handle
>the caching like this:
>
>The data you have requested is currently being reloaded from the
>main database. Please check back in 5 minutes.
>
>How would I do this?
You could load it as an application variable and set it to timeout
when you wish. Just set the time it was set also.
<cfset timeout = 20> (I'll use minutes as an example)
<cfapplication
blah
applicationtimeout = "#createtimespan(0,0,timeout,0)">
<cfif not isdefined('application.mycachedquery')>
<cfquery name="myquery" blah blah blah>
<cfset application.querytimeout = dateadd('N', timeout, now()>
<cfset application.mycachedquery = myquery>
<cfelse>
Of course, I presume you'd want to set a time near the end of the
timeout where they can't access the query. Otherwise, no one will be
able to access it after the first person runs it until it times out
again. We'd do that in here by testing the time now() against
application.querytimeout.
</cfif>
--
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists