Raymond,

On a side note, would it be better to use cfquery's cachedwithin or cachedafter 
instead of having to take care of the cache myself? If so, how would I do that?

Cedric

>I'd watch out using  local variable name w/ the same name as the method.
>You should probably use another name and var scope it. Also, in general,
>I wouldn't directly access the application scope from within the CFC.
>What if you want to use the server scope instead? It would make more
>sense to just use:
>
><cfset application.myEntries = theCFC.getEntries(...)>
>
>Or at least use another CFC to abstract where the caching is done.
>
>========================================================================
>===
>Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
>(www.mindseye.com)
>Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
>
>Email    : [EMAIL PROTECTED]
>Blog     : www.camdenfamily.com/morpheus/blog
>Yahoo IM : morpheus
>
>"My ally is the Force, and a powerful ally it is." - Yoda 
>
>> -----Original Message-----
>> From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] 
>> Sent: Wednesday, July 30, 2003 10:41 AM
>> To: CF-Talk
>> Subject: RE: Caching until updated
>> 
>> 
>> <cffunction name="getEntries" returntype="query">
>>      <cfargument name="updateCache" required="true" default="1">
>> 
>>      <cfif not IsDefined('Application.myEntries') or 
>> Arguments.updateCache>
>>              <cfquery name="getEntries">
>>                      SELECT  *
>>                      FROM    EntriesTable
>>              </cfquery>
>>              <cfset Application.myEntries=getEntries>
>>      </cfif>
>> 
>>      <cfreturn Application.myEntries>
>> </cffunction>
>> 
>> On your update entry page just do
>> 
>> mycfc.getEntries(1|0)
>> 
>> -----Original Message-----
>> From: Cedric Villat [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, July 30, 2003 12:46 PM
>> To: CF-Talk
>> Subject: Caching until updated
>> 
>> 
>> I'm sure there is a way to do this, I just can't seem to 
>> think through it. Basically, I have a table which isn't going 
>> to change much. Instead of pulling this information from the 
>> database, I'd like to cache the query in the Application 
>> scope. But when a record IS added to that table, I would like 
>> to reset the cached version to include the change.
>> 
>> Basically, how can I cache something until I know the records 
>> it contains changes? If it helps, I'm using CFC's and can 
>> easily do this in the INSERT function, just can't figure it 
>> out. Any help?
>> 
>> Cedric
>> 
>> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to