My understanding though is that you have to do a duplicate on any
complex data types (structs, arrays, queries etc.) you "copy" from
application to local page vars (whatever the scope) otherwise, without
locks you are still open to corruption because you are accessing the
original application var via a pointer rather than a unique local
version of it.


Douglas Brown wrote:
> 
> My preference in this situation is to always use request vars and create a
> struct for them. I use a local page for all scoping of variables and just do an
> include in my application page
> 
> IE:
> 
> <!--- initialize the structures --->
> <cfsilent>
> <!---Set our struct for global site variables//--->
> <cfset request.site=structnew()>
> <!---Set our struct for local page variables//--->
> <cfset request.page=structnew()>
> <!--- Root folder variable //--->
> <cfparam name="request.site.cfroot" default="/2netcorp.com">
> 
> <!--- Site DSN variable --->
> <cfparam name="request.site.forum_dsn" default="2Netboard">
> 
> <!--- Global Email address variables//--->
> <cfset request.site.webmaster_email = "[EMAIL PROTECTED]">
> <cfset request.site.support_email = "[EMAIL PROTECTED]">
> <cfset request.site.info_email = "[EMAIL PROTECTED]">
> <cfset request.site.sales_email = "[EMAIL PROTECTED]">
> <cfset request.site.cust_service_email = "[EMAIL PROTECTED]">
> <cfset request.site.forum_name = "2Net Corp Message Board">
> </cfsilent>
> 
> "Success is a journey, not a destination!!"
> 
> Doug Brown
> ----- Original Message -----
> From: "Dave Watts" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, April 14, 2002 11:16 AM
> Subject: RE: Simple Application.cfm Question
> 
> > > In the application.cfm I write the following:
> > >
> > > <CFSET APPLICATION.webroot = "http://www.mysite.com";>
> > >
> > > Then I call this on certain pages in the application,
> > > such as: <CFOUTPUT>#APPLICATION.webroot#</CFOUTPUT>
> > >
> > > My question is this:
> > >
> > > 1) Do I need to use locks around everytime I call this
> > > APPLICATION variable?
> >
> > Well, the generic recommendation I give in this situation is, yes, you must
> > lock every instance of any memory variable. There are those who disagree,
> > specifically with Application or Server variables, who will argue that as
> > long as the variable is locked, and only written to once, there shouldn't be
> > any problem. In my opinion, I'd rather be safe than sorry, since memory
> > variables have caused enough trouble in applications I've seen.
> >
> > > 2) Can I get away with using a REQUEST variable instead of
> > > APPLICATION variable when I write CFSET commands, such as
> > > (I know I can do REQUEST variables for calling DSN connections):
> > >
> > > <CFSET REQUEST.webroot = "http://www.mysite.com";> then
> > > <CFOUTPUT>#REQUEST.webroot#</CFOUTPUT>
> >
> > Yes, not only can you "get away with it", but in the case of variables which
> > are essentially static through the lifespan of the application - datasource
> > names, file paths, and the like - I'd strongly recommend that you use either
> > the Request or the local Variables scope and simply set these variables in
> > Application.cfm.
> >
> > Dave Watts, CTO, Fig Leaf Software
> > http://www.figleaf.com/
> > voice: (202) 797-5496
> > fax: (202) 797-5444
> >
> >
> 
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to