Re: [Cppcms-users] per request data storage?
Brought to you by:
artyom-beilis
|
From: Heiko I. <hi...@93...> - 2013-12-05 18:38:57
|
Hi, thanx, i thought about singleton, but wouldn't this be application wide? So if i store user information in a singleton, everyone would count as that user? Kind regards, Heiko On Fri, Dec 06, 2013 at 12:08:05AM +0800, 陈抒 wrote: > Not sure the different locations mean what? Different web URLs? > If you want to save something in web app, in my way, I usually create a > singleton object called my_app, you could use any singleton technology to > create it. And save the variables that you want to cache and share as the > my_app object's member variable. > For multi-thread protection, use boost::mutex to protect them. > > > Dean Chen > Best regards > http://blog.csdn.net/csfreebird > > > On Thu, Dec 5, 2013 at 11:45 PM, Heiko Irrgang <hi...@93...> wrote: > > > Hi, > > > > hm.. maybe i'm missing something here... i do not want to store full > > user information in the session cookie, i just want to safe it somewhere > > for the current request, so i do not re-re-re-re-read it from the > > database, just because i need it on 5 different locations. > > > > i already have a cookie session running, but it only holds the user id > > and a usertoken. > > > > What i would need is some storage, that is neither file/cookie based and > > does not interfere with the session. > > > > Pretty much like some local variables in the actual application instance, > > but on a point where i do not have this application instance. > > > > Is something like this available, or do i have to give the application > > instance as parameters to every function that might need information > > limited to the current request? > > > > Maybe i'm just thinking too much php here ;) > > > > Thanx in advance, > > Heiko |