Nothing wrong with a cfc having access to persistent data...I'd say an
app variable is the best way to do this. Just make the cfc test to see
if 24 hours have passed between refreshes. Application variables
aren't the only way to make data persist...you could use a db, or the
filesystem.

Some skeleton code I did for something similar in CF5.

<cfset doupdate = 0>
<cfset variables.updateInterval = 15>
<!--- <cfset application.nextupdate = dateadd('n',1,now())>  In case
you need to manually flush cache --->

<cflock timeout="5" type="EXCLUSIVE" scope="APPLICATION">
        <cfif NOT isDefined("application.nextupdate")>
                <cfset application.nextupdate = now()>
        </cfif>
</cflock>

<cflock timeout="5" throwontimeout="No" type="READONLY" scope="APPLICATION">
        <cfif dateDiff('n',now(),application.nextupdate) LTE 0>
                <cfset doupdate = 1>
        </cfif>
</cflock>

If doupdate equals one, run your query, otherwise don't. I can imagine
putting the above check in the constructor code, and setting a
obj.doupdate property...

-- 
 jon
 mailto:jonhall@;ozline.net

Monday, October 28, 2002, 4:56:20 PM, you wrote:
BM> The problem seems to be that none of the query information is available
BM> until the line in the code where the cfquery statement is.  Therefore, I
BM> can't figure out a good way to skip over all the code.

BM> I would use an application variable to flag weather the query is current
BM> cached or not, and the time since it was first cached, but all this code is
BM> in a .cfc and I want to keep it portable as possible.

BM> Byron Mann

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to