I would use a cfif isdefined block to check if they've been set
and if not then do the include. There's no reason to keep resetting 
them. There is no danger of a race condition unless 2 users 
could be trying to set them to different values. 

There's a big difference between this and using local vars 
though. With local vars each user would be recreating a new
copy for each .cfm template loaded, whereas with application 
vars they all share the same one.



>I have a CFMX site from a new customer of ours. They are using the
>application scope in a way I've never seen before. They have a single
>include file in the Application.cfm file that has a series of sets in it.
>
>
><Cfset application.var1 = 'blah'>
><Cfset application.var2 = 'blah'>
><Cfset application.var2 = 'blah'>
>
>There are approxiamately 30 or 40 such sets.  There is no control "cfif"
>clause at all - meaning these ap variables are set with each request.  I
>think this is silly and they might as well be using local variables -
>because they are overwriting the ap variables with each request.
>
>I can't see any purpose to doing it this way?  Is there any advantage to
>using the ap scope like this. I always do something like:
>
>
><cfif NOT IsDefined('application.somevar') OR isdefined('url.Refreshvar')>
>
>       <Cfset application.var1 = 'blah'>
>       <Cfset application.var2 = 'blah'>
>       <Cfset application.var2 = 'blah'>
>
></cfif>
>
>I also think there is a potential here for race conditions under a heavy
>load.
>
>So, can anyone see a reason why I should not change this set of constants to
>use the application scope appropriately?
>
>-mk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=35

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183079
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to