Hi Barney,

That is exactly what I was looking for.  I should have thought of that.

Your code brings up another question. Is there any difference between structKeyExists and IsDefined? Why should someone use structKeyExists instead of IsDefined since IsDefined is simplier to remember?

Johnny

>You can't use CFCACHE for caching the result.  However, you can easily
>cache it manually.  Inside your CFC, before you return the result,
>store it in an application-scope variable.  Then, before you do the
>processing, add a check to see if that variable is defined.  If it is,
>just return it, and skip the processing.
>
>Here's some psuedo-code:
>
><cffunction name="getThing">
>  <cfset var thing = "" />
>  <cfif NOT structKeyExists(application, "myThing")>
>    <cfset thing = timeConsumingMethod() />
>    <cfset application.myThing = thing />
>  </cfif>
>  <cfreturn application.myThing />
></cffunction>
>
>If you need to automatically expire the cache, you can set up a
>scheduled task that will delete that variable from the application
>scope as needed.
>
>cheers,
>barneyb
>
>On Sun, 17 Oct 2004 23:42:56 -0400, Johnny Le <[EMAIL PROTECTED]> wrote:
>--
>Barney Boisvert
>[EMAIL PROTECTED]
>360.319.6145
>http://www.barneyb.com/blog/
>
>I currently have 2 GMail invites for the taking
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to