i’m planning on making my own custom session handling functions. i want to save it in the database but i have some doubts.
-
is it viable or will just slow down my app?
-
i have to save the session after each
setor can i just save it all at once? because i had this idea to put this function in the class destructor method. so, when the program ends, it will save the data in the database.-
but how can i use my other class (database class) for this, being sure it won’t be destructed before the session class?
-
if the user quits the connection and the app stops running, the destructor will still be called?
-
so, what do you guys think? what do you suggest me to do?
I use DB sessions all the time with Zend and Symfony so its definitely viable, there will be a cost of course but most likely nothing significant.
Normally the way these handlers work is to use
session_set_save_handlerthat way it works as normal except for the actual function called which writes the data. However pay attention to the warnings about object destruction.