Dave:

 

I thought that it was better to store as few variables as possible in
the application scope.  Is that not the case?

 

 

--------------------------------------------------------

 

Kevin Fricke

Lone Star Media

[EMAIL PROTECTED]

Office: (512) 371-1822

Mobile: (512) 626-0528

Fax: (512) 597-0909

Toll Free: (877) 791-7083

 

http://www.lonestarmedia.com

 

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave Shuck
Sent: Thursday, May 10, 2007 2:21 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: Re: [DFW CFUG] Application Variables

 

I wouldn't :)

I often include things like this in configuration files rather than
inline in the code to keep it more portable, but there is nothing that
would keep you from doing this inline in your Application.cfm .  

I would actually take it a step further though.  Just to keep from
setting and resetting on your application on every request I set my
application scoped variables in a block like this:

<cfif NOT StructKeyExists(application,"DawnsDsn")> 
        <cflock name="#application.applicationname#_DawnsDsn"
type="exclusive" timeout="30">
                <cfif NOT structKeyExists(application,"DawnsDsn")>
                    <cfset application.DawnsDsn = "SuperCoolDsn" />
                 </cfif>
         </cflock>
</cfif>

The second conditional check is to ensure thread safety, which is not a
really important issue when it comes to something like setting a DSN,
but imo is still good practice. 

Hope that helps.

~Dave



On 5/10/07, Green, Ms. Dawn <[EMAIL PROTECTED]> wrote: 

In an application.cfc page, why would you use request variables to set
your datasource, rootname of your site & adminEmail instead of
Application variables?

 

What are the pros and cons of doing it either way?

 

Thanks for any help in clarifying this for me.

 

Dawn Green


_______________________________________________
Reply to DFWCFUG:
 [email protected]
Subscribe/Unsubscribe: 
 http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
  http://www.mail-archive.com/list%40dfwcfug.org/
<http://www.mail-archive.com/list%40dfwcfug.org/> 
DFWCFUG Sponsors:
 www.instantspot.com/
  www.teksystems.com/ <http://www.teksystems.com/> 




-- 
~Dave Shuck
[EMAIL PROTECTED]
http://daveshuck.instantspot.com 

_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.instantspot.com/
  www.teksystems.com/

Reply via email to