If you're going to end up instantiating this component anyway (which based
on that construct, it seems you'd do) why not do the caching outside the
component?

Also, can you explain why the this = server.foo would be necessary in that
case?  Once you are in the component, why are you wanting to replace itself
with an old instance of itself?





> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Brad Howerter
> Sent: Thursday, August 14, 2003 12:37 PM
> To: '[EMAIL PROTECTED]'
> Subject: [CFCDev] Caching a CFC
>
>
> I'd like to have a CFC put itself in cache, and then replace itself with
> that cached object whenever it is created.
>
> Is that possible?  Is it stupid?
>
> Will this code do the trick, or is 'this' not really a reference to the
> current object, but just a scope within the object?
>
> <cfcomponent displayname="foo">
>       <cfparam name="server.foo" default="#this#">  <!--- put this object
> in server cache --->
>       <cfset this = server.foo> <!--- replace this object with the cached
> one --->
>
>       <!--- methods to follow --->
>       ...
> </cfcomponent>

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to