But either way you have to understand that simply using a variable without VARing it, will cause race conditions. This was a problem with our application a few months back and took me a while to diagnose, until I realized that all our cfquery name's were named qry and that there was no <cfset var qry=""> in each method. So if 2 methods were called at the same time, the last one to finish running the query wins, and then you start getting weird errors under load. It's an easy thing to miss..
-----Original Message----- From: Brian Kotek [mailto:[EMAIL PROTECTED] Sent: Friday, September 02, 2005 7:33 PM To: CF-Talk Subject: Re: CFC's - Most efficient scope? That's why I said "nearly always". If you do end up needing an application-scoped CFC that changes state, and if race conditions are a concern, then you need to lock the writes to the instance data of the CFC. On 9/2/05, Paul Kenney <[EMAIL PROTECTED]> wrote: > This is not always the case. Sometimes CFCs are placed in the application > scope with state that changes all the time. The CFC could be a very busy > manager, and not just a stateless utility or something. It might be in the > application scope because you only want one, and no more. > > On 9/2/05, Brian Kotek <[EMAIL PROTECTED]> wrote: > > > > You only need to lock to prevent race conditions. Since > > application-scoped CFCs should nearly always be stateless (they have > > no instance data, or the instance data does not change once the > > component is initialized), locking isn't an issue. > > > > On 9/2/05, Snake <[EMAIL PROTECTED]> wrote: > > > What about locking ? > > > > > > - > > > snake > > > > > > -----Original Message----- > > > From: Russ [mailto:[EMAIL PROTECTED] > > > Sent: 02 September 2005 14:59 > > > To: CF-Talk > > > Subject: RE: CFC's - Most efficient scope? > > > > > > Well we usually use > > > > > > <cfinvoke object="application.myCFC" method="myMethod" > > > returnVariable="variables.myvar" argument1="value" argument2="some other > > > value" /> > > > > > > Or the proper way to do it > > > > > > <cfinvoke object="application.myCFC" method="myMethod" > > > returnvariable="variables.myvar"> > > > <cfinvokeparam name="argument1" value="myvalue"> > > > <cfinvokeparam name="argument2" value="some other value"> > > > </cfinvoke> > > > > > > > > > I think storing it in the application scope is the best place, since > > then > > > you can share it throughout your application. We do the same thing... we > > > have all our db calls in different cfc's, and we keep them in > > application > > > scope. Since they're cached until the application is reset, they're very > > > efficient. > > > > > > Russ > > > -----Original Message----- > > > From: Andy Mcshane [mailto:[EMAIL PROTECTED] > > > Sent: Friday, September 02, 2005 5:16 AM > > > To: CF-Talk > > > Subject: CFC's - Most efficient scope? > > > > > > Hi, been playing around with CFC's and fusebox4.1 for a bit, nothing too > > > advanced. In the main part I use CFC's to do all of my database work, > > they > > > contain all of my calls to the database using stored procedures. My > > question > > > is what is the best amd most efficient way to execute them? At the > > moment I > > > initialize all of my CFC's into the application scope and then in my > > fusebox > > > model xml file use the following syntax; > > > > > > <invoke object="application.MyObject" > > > methodcall="MyMethod( Arg1, Arg2, etc)" > > > returnvariable="MyReturnVar"> > > > > > > OR > > > > > > <invoke object="application.MyObject" > > > methodcall="MyMethod( argumentcollection=MyArgs )" > > > returnvariable="MyReturnVar"> > > > > > > Is this an efficient way of doing this? Is there a better way to do it? > > Have > > > I completely misunderstood the use of CFC's? > > > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217267 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

