Good point Spike, I should have added that creating an application-scoped singleton is a good idea *as long as the CFC is stateless*. I was assuming that if it is a simple utility CFC that it probably would be, but you never know. If you're storing and modifying instance data in an application or session scoped CFC then you need to start worrying about locking and race conditions.
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Spike > Sent: Wednesday, September 29, 2004 2:10 PM > To: [EMAIL PROTECTED] > Subject: Re: [CFCDev] Function Libraries > > If the CFC methods are stateless I would go with Jim's suggestion. > Create a single instance of the CFC and pass that into a 'constructor' > method of any component that needs access to those methods. Which scope > you store the CFC in will depend on your application and what the > methods in the CFC do. > > Spike > > > Marlon Moyer wrote: > > On Wed, 29 Sep 2004 12:55:10 -0400, Brian Kotek <[EMAIL PROTECTED]> > wrote: > > > >>You could also just create an instance variable that holds your UDF CFC > >>in your init() function. > >> > >><cffunction name="init"> > >> <cfset variables.udfObject = createObject( 'component', 'udf' ).init() > >>/> > >> <cfreturn this /> > >></cffunction> > >> > > > > This is how I do it right now, but it just seems that if every object > > in each session instantiate the function library, there's a lot of > > memory being used. > > > > > > -- > > -------------------------------------------- > Stephen Milligan > Code poet for hire > http://www.spike.org.uk > > Do you cfeclipse? http://cfeclipse.tigris.org > ---------------------------------------------------------- > 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]
