Thanks for your help Dave - this really helps.

Thanks,
Mark


-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, April 14, 2002 2:16 PM
To: CF-Talk
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


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
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