I heard someone mention temp variables, and I had some questions about best practices in using them. Anyone mind giving some peer review?
I am serious about locking all application and session scope variables. In my application.cfm, I put a read-only lock around the application scope and duplicate the whole structure into the request scope. Then I call all application variables from there, and only set application variables from within an exclusive lock. I do the same thing for the session scope. This has some obvious issues: 1) Being in application.cfm, this code runs before each and every page. When I need to change the value of a variable in either the application or session scopes, I change it and duplicate the scope's structure again later on in the page. Which means data is being locked, duplicated, unlocked, locked, set, duplicated, unlocked, etc. 2) Race conditions - Is there ever a time when race conditions exist in this model? It is possible, at times, two pages could be in a rush to set application variables, i.e. two different users are trying to do the same thing at the same time. I am considering putting an additional level of record locking on the application and session scopes, such as a time/date field that would be used in a check to see if anyone overwrote the record since the user last loaded the page. As far as 1) goes, does anyone have some comments on whether or not this is the best way to go about this? As far as 2) goes, has anyone ever tried this before? M ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

