Where to create session instances?
So I am creating C++ HTTP emulating via TCP server. I will have simple authentification service which will be created in C++. I will have sessions. I wonder which form shall I give them - real files on server or lines in SQL Lite db I use for my server? Or just keep them in RAM开发者_如何学编程? Which way is better for performance / safety?
It all depends what you want to do:
- keep them in sqlite is safer than file (you're sure it's either written or not, no half status). Moreover, it's either to fetch your session with a query. In that sense, it's safer
- keep them in RAM will be better in terms of performance, but all sessions will be lost when you restart your server
精彩评论