Re: [Cppcms-users] per request data storage?
Brought to you by:
artyom-beilis
|
From: Shiv S. D. <shi...@gm...> - 2013-12-06 05:39:57
|
You can use something like Redis for this which is in-memory database. On Fri, Dec 6, 2013 at 11:02 AM, Heiko Irrgang <hi...@93...> wrote: > Hi, > > well, thats exactly the point, i am not storing the session in a > database and therefor i do not want to save things like user password in > the browser cookie. > > using a database for session storage would definately be an option, but > as far as i see, this involves dynamic linking, i do not want this, when > my project is near to finish, i will get a commercial license and link > everything into a single file, having some extra files in the filesystem > is not an option. > > any way to implement db session without dynamic linking? > > Kind regards, > Heiko > > On Fri, Dec 06, 2013 at 12:25:11PM +0800, 陈抒 wrote: > > 1. You can save a key-value data structure in singleton application > object, > > key will be user id, value can be any user-specific data. > > But if you do this, you actually implement your own version of user > > session. Why not use cppcms session? > > > > 2. If the web server has session, it's not stateless anymore. When > > clustering several web servers together to do load balance and to prevent > > single point of failure, sync these session between these web servers are > > important and hard job. So my way is to avoid use session, just use > > database cluster or cache server to hold session values. > > > > > > Dean Chen > > Best regards > > http://blog.csdn.net/csfreebird > > > > > > On Fri, Dec 6, 2013 at 2:38 AM, Heiko Irrgang <hi...@93...> wrote: > > > > > 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 > > > > > > > > > > ------------------------------------------------------------------------------ > > > 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 > > > > > > > ------------------------------------------------------------------------------ > > 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 > > > -- > Heiko Irrgang > 93-interactive > Hochfeldstr. 30 > 82377 Penzberg > Germany > > Web....: http://93i.de > Email..: hi...@93... > Phone..: +49-160-7873168 > > > ------------------------------------------------------------------------------ > 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 > -- Respect, Shiv Shankar Dayal |