Try this:
In your application.cfm
<cfif IsDefined("URL.refreshQueryCache")>
<cfset request.cachetimespan = CreateTimeSpan(0,0,0,0)>
<cfelse>
<cfset request.cachetimespan = CreateTimeSpan(1,0,0,0)>
</cfif>
Then...
<cfquery name="query" datasource="dsn"
cachedwithin="#request.cachetimespan#">
...BLAH...
</cfquery>
For this to work you need to call the page with a URL parameter and it
needs to be the page that has the query on it.
Alternatively, for more granular control:
<cfif isDefined("application.recache")>
<cfset request.cachetimespan = CreateTimeSpan(0,1,0,0)>
<!--- Remove the application variable so this doesn't get
re-cached again next time until it is set again else where... --->
<cfset StructDelete(application,"recache")>
<cfelse>
<cfset request.cachetimespan = application.cachetimespan>
</cfif>
<cfquery name="query" datasource="dsn"
cachedwithin="#request.cachetimespan#">
...BLAH...
</cfquery>
etc.
Hope that helps,
Andr�
-----Original Message-----
From: Jim Banks [mailto:[EMAIL PROTECTED]
Sent: 05 June 2003 13:19
To: CF-Talk
Subject: CFQUERY - cachedwithin
When you have used cachedwithin in CFQUERY, is it possible to override
that before the cachedtime is up? For example,
<cfif not isdefined("application.recache")>
<cfquery name="query" datasource="dsn"
cachedwithin="#createtimespan(0,1,0,0)#">
...BLAH...
</cfquery>
<cfelse>
<cfquery name="query" datasource="dsn">
...BLAH...
</cfquery>
<cfset temp = structdelete(application, "recache")>
</cfif>
Here, it'd be great if I could 'reset' the query so that if I've defined
somewhere else on the site that the query has changed using the
application variable, I can get it to use the new query results and
cache that for next time, instead.
Thanks!
---------------------------------
Yahoo! Plus - For a better Internet experience
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4