RE: Persistent Session variables
We did something similar with our Application Variables. We needed some way for them to be automatically re-generated after a server cycle. What we do is write a simple text file whenever the Application variables are updated, then check for the existence of the necessary Application (again all grouped into a structure for convenience [Application.State.var1, Application.State.var2, ect]. If the State structure does not exist in Application, then the text file is read and parsed to create it. -- Ian Skinner Web Programmer BloodSource Sacramento, CA -Original Message- From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] Sent: Monday, July 28, 2003 6:35 AM To: CF-Talk Subject: RE: Persistent Session variables awesome. :) > This works in CFMX > > Ade > -Original Message- > From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] > Sent: 28 July 2003 14:05 > To: CF-Talk > Subject: RE: Persistent Session variables > Very possibly. I'm pretty sure it doesn't work with CF5. I > hadn't heard > anything about changes to the client scope in mx > specifically... I know that > with previous versions of the server there were frequently > other collections > of variables that weren't structures that would become > structures with later > versions. >> 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... >> >> 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/uns >>
RE: Persistent Session variables
awesome. :) > This works in CFMX > > Ade > -Original Message- > From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] > Sent: 28 July 2003 14:05 > To: CF-Talk > Subject: RE: Persistent Session variables > Very possibly. I'm pretty sure it doesn't work with CF5. I > hadn't heard > anything about changes to the client scope in mx > specifically... I know that > with previous versions of the server there were frequently > other collections > of variables that weren't structures that would become > structures with later > versions. >> 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... >> >> 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/uns >> ubscribe.cfm?user=633.558.4 > s. isaac dealey972-490-6624 > new epoch http://www.turnkey.to > lead architect, tapestry cms http://products.turnkey.to > tapestry api is opensource http://www.turnkey.to/tapi > team macromedia volunteer > http://www.macromedia.com/go/team > 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 >
RE: Persistent Session variables
This works in CFMX Ade -Original Message- From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] Sent: 28 July 2003 14:05 To: CF-Talk Subject: RE: Persistent Session variables Very possibly. I'm pretty sure it doesn't work with CF5. I hadn't heard anything about changes to the client scope in mx specifically... I know that with previous versions of the server there were frequently other collections of variables that weren't structures that would become structures with later versions. > 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... > > 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/uns > ubscribe.cfm?user=633.558.4 s. isaac dealey972-490-6624 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi team macromedia volunteer http://www.macromedia.com/go/team 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Persistent Session variables
Very possibly. I'm pretty sure it doesn't work with CF5. I hadn't heard anything about changes to the client scope in mx specifically... I know that with previous versions of the server there were frequently other collections of variables that weren't structures that would become structures with later versions. > 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... > > 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/uns > ubscribe.cfm?user=633.558.4 s. isaac dealey972-490-6624 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi team macromedia volunteer http://www.macromedia.com/go/team 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 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
RE: Persistent Session variables
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... 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
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... 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4