Also don't forget to var all your variables in the cfc... Since it's cached,
the variables are shared throughout the cfc, and a lot of weird stuff will
start to happen if you use the same variable in multiple places (or even in
the same method probably) under more then a light load.  

So if you have a query and you're doing something like this

<cfquery name="qryName" datasource="blah">
Some query
</cfquery>

Don't forget to var the name like this

<cfset var qryName="">
<cfquery name="qryName" datasource="blah">
Some query
</cfquery>

And the same with any other variables you use... 

Russ

-----Original Message-----
From: Russ [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 02, 2005 9:59 AM
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?





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217234
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

Reply via email to