I just got the following advice in a HostMySite CF newsletter. Is there an issue with session scopes in custom tags? I've received other coding "tips" from them that make no sense or is just plain bad advice but not sure what to make of this.
---- Coding Tip Discover methods used by HostMySite's CFMX gurus to address your common coding and performance issues. Stop by the Developers' Forum to discuss with fellow ColdFusion users. Duplicate Your Session Scopes to Relieving Memory Issues When you use custom tags to place exclusive locks around the session scope, it causes ColdFusion service issues, which affects all users within a shared environment. You can prevent these ColdFusion service issues by using a common fix we use to fine tune our code: Use a variable scope to remove the memory being used by the session scope once the tag has completed it's necessary action. <cflock timeout="45" throwontimeout="Yes" type="READONLY" scope="SESSION"> <CFSET variables.LSess=Duplicate(session)> </cflock> We would be replacing all references of session to variables.LSess and copying the local copy of the structure back to the session scope. <cflock timeout="45" throwontimeout="Yes" type="EXCLUSIVE" scope="SESSION"> <CFSET session=Duplicate(variables.LSess)> </cflock> If you have difficulty copying over structures in your local version to the session scope, you can duplicate each key under the local session structure over to the scope. Your final code would look similar to: <cflock timeout="45" throwontimeout="Yes" type="EXCLUSIVE" scope="SESSION"> <CFLOOP index="Key" list=#StructKeyList(variables.LSess)#> <CFSET "Session.#Key#"=Duplicate(Evaluate(" variables.LSess.#Key#"))> </CFLOOP> </cflock> ---- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262642 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4