> Hi everyone
> Under the philosophy that rules are made to be broken, I
> have routinely
> broken the rule about always locking session variables.
> However, I'm trying to mend my ways.
> My question is this:
> Do I need to lock my session variables in the following
> example? If so,
> what is the best / quickest / easiest way to do so:
> <CFIF IsDefined("Session.Collections.Role") AND
> (Session.Collections.Role EQ
> "Medium" or Session.Collections.Role EQ "High")?
> To my mind, having to code a lock for the session variable
> used in the above
> if statement adds a lot of extra lines of code, and takes
> longer to develop.
> (My CF5 administrator settings are No automatic checking
> or locking for
> server, application and session scope vars, and the single
> threaded sessions
> box is not checked.)
If this is software that's intended for consumption by other companies, I
would recommend this in your application.cfm
<cflock scope="session" type="readonly" timeout="20">
<cfset request.session = duplicate(session)>
</cflock>
Then make all reverences to session. ( as above ) within the rest of your
templates to request.session instead. This prevents you having to fill the
application up with tons of cflock tags and ensures that the app will work
on someone else's server, even if they have full-checking enabled in the cf
administrator. This is also a good way to easily ( little code ) shore up
those leaky session variables prior to CF MX.
If this is software intended solely for internal consumption, you can get
better performance by name locking individual variables or routines,
although it requires more code, and afaik there's still the risk of leaky
session vars prior to MX.
s. isaac dealey 954-776-0046
new epoch http://www.turnkey.to
lead architect, tapestry cms http://products.turnkey.to
certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com