Could the fact that CF(MX?) treats the CLIENT scope as a structure internally allow you to use CLIENT[varname] = myValue; ?
Ade -----Original Message----- From: s. isaac dealey [mailto:[EMAIL PROTECTED] Sent: 25 July 2003 20:34 To: CF-Talk Subject: RE: Persistent Session variables Great suggestion... The only thing I'd add is that you might consider a user defined function for setting client/session variables... function setSession(varname,myvalue) { session[varname] = myvalue; "client.#varname#" = myvalue; } I'm not sure off the top of my head if that works... I'm inclined to expect it to throw an error on "client.#varname#" = in the function call even though it works outside of cfscript... and as there's no setclientvariable() function and "client" isn't a structure, I'm not sure how else I'd accomplish it... in any event -- the idea is that you don't want to have to remember to set 2 variables every time you want to set that session variable, so the function lets you do it with just the one statement... <cfset setSession("userid",myquery.userid)> Original Message ----------------------- 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 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4