I thought some of you might find this interesting.
For an application I needed to have the speed of reading Session variables from RAM,
combined with the persistence of Client variables that don't go away if the Coldfusion
server is cycled (restarted) and RAM is tossed out. (something that happens too often
on a shared server)
The solution is relatively simple:
I kept these 'persistent session variables' all together in a structure just to make
working with them easier.
Every time I needed to write (change) the variables I updated both a session variable
AND a client variable.
Every time I needed to read the variables I simply read from a session variable.
I have code that runs before every page (Fbx_settings for Fusebox or Application.cfm
otherwise) that checks if there is no current session (NOT
IsDefined('session.insession')). If not, then I mark the current session (
session.insession='yes') and copy the client variable to a session variable.
Think of the client variable as a 'backup' for the session variable.
Slight speed hit on writes in return for persistence across reboots and restarts.
-Peter Theobald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4