Marlon,

You could also bind a CFC instance variable to the session or application
scope (or a sub struct within the scope) and have a shared variable among
all INSTATIATED cfcs within the particular uses session or the current
application.

   <cfcomponent name="foo">
      <cfset variables.shared = StructGet("session.shared.foo")>

      <cffunction name="getBar" returntype="string" access="public">
         <cfreturn shared.bar/>
      </cffunction>
   </cfcomponent>

I've used this method in the past, and it works pretty well.  You have to be
aware of is concurrency issues and take care of them with the appropriate
locks.  Also, beware if you use this in conjunction with inheritence.



Paul Kenney
[EMAIL PROTECTED]
916-212-4359

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Sean A Corfield
> Sent: Wednesday, April 21, 2004 12:02 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [CFCDev] Static variables
>
>
> On Apr 21, 2004, at 11:25 AM, Marlon Moyer wrote:
> > Is there such a thing as a ‘static’ type in CFC’s
>
> No. CFCs require an instance in order for you to do anything.
>
> Well, that's not 100% true. You can do *some* manipulations -
> using CF
> internal methods in Java - without an instance...
>
> Regards,
> Sean
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[EMAIL PROTECTED]


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

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

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to