This makes no sense:
"If it is for a past month, I want to start the caching from after the last day of that month" You are already *after* the last day of the previous month. Having such a statement is unnecessary. Just use the cachedwithin parameter and be done with it. It's a good idea not to store caches in memory for too long (e.g. more than a day). Otherwise, create a method for caching your queries based on parameters. Store them in memory (e.g. application scope) or save them to file (e.g. WDDX). At least that way you have full control over when and how your queries are cached. Joel Cass Developer Gruden - Design | Development | Implementation t +61 2 9299 9462 f +61 2 9299 9463 m 0414 688 774 www.gruden.com <http://www.gruden.com/> ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of AJ Mercer Sent: Tuesday, 8 April 2008 11:26 AM To: [email protected] Subject: [cfaussie] CF702 - cfquery caching Hi Fusioneers, I have an SQL I would like to cache, but have two strategies depending on the parameters If the parameters are for the current month, I only want to cache the query for 1 day If it is for a past month, I want to start the caching from after the last day of that month cfquery has two attributes to do this - cachedwithin - cachedafter So I thought I would do this, but it looks like CF does not like the CFIF inside the cfquery tag <cfset rptDate = CreateDate(URL.year, URL.month, DaysInMonth(Now())) /> <cfquery name="qryStatsByMonth" datasource="#APPLICATION.DataSourceMain#" <cfif DateDiff('m', rptDate, Now()) EQ 0> cachedwithin="#CreateTimeSpan(1,0,0,0)#" <cfelse> cachedafter="#rptDate#" </cfif> > Any ideas how I can do this? For now, I will put the cfif on the outside and have two cfqueries. Guess this is not a bad way of doing it, just thought it would be neat if it could be done with one query. -- AJ Mercer Web Log: http://webonix.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---
