With PHP and MySQL I am working on a user login type site. Here is my plan so far.
User logs in with email/password I then set a few things into session (UserID, photoURL, userName, latitude, longitude, gender) These are the basic items that will be saved into session and possibly APC/Memcache when a user is “logged in”.
I have my session handling and cache handling wrapped in Classes so there is a user object which is getting the data on each page load by creating a session and cache object as well and then importing those objects into a main User object.
Now I am confused, I have always done it this way or similar but I know that some people serialize there objects and then save them to session or cache and then retrieve the object on page load. Would it be better to do it that way?
i think you don’t have to think about it. I work as a php developer at my company where we have a webpage with literally hundreads of objects created every time a page loads and it’s serving pages to like 50-200 people at a time and it takes just about 50ms to generate the page. So if you realy don’t need the extra speed gained from serializing objects then you don’t have to worry about it.