Re: [Cppcms-users] per request data storage?
Brought to you by:
artyom-beilis
|
From: 陈抒 <csf...@gm...> - 2013-12-05 16:08:33
|
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 > > On Thu, Dec 05, 2013 at 07:21:04AM -0800, Artyom Beilis wrote: > > http://cppcms.com/wikipp/en/page/cppcms_1x_sessions > > > > Artyom Beilis > > -------------- > > CppCMS - C++ Web Framework: http://cppcms.com/ > > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > -------------------------------------------- > > On Thu, 12/5/13, Heiko Irrgang <hi...@93...> wrote: > > > > Subject: [Cppcms-users] per request data storage? > > To: cpp...@li... > > Date: Thursday, December 5, 2013, 4:50 PM > > > > Hi there, > > > > how can i save data per request? > > > > I store the user id in a browser cookie, then there is a > > function > > called getCurrentUser() which looks into the cookie, then > > gets the user from the database. > > > > Obviously i do not want to have a database query every time > > getCurrentUser() is called within one request, so i want to > > store the current user for the current request. > > > > How can i do this? > > > > Thanx in advance. > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |