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:
> Is it possible to cache the result of a web service?  I created a web
> service to use in my flash application, but it takes a long time to return
> the result.  Since the result is not going to change often, I wonder if I
> could cache it.
>
> If so, where should I put the cfcache tag?  Outside the component tag?
> Inside the component tag but outside the method? Or inside the method?
>
> Johnny
>
--
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