Hi,
I have Object that performs not only registration/Login but also manages users after the log in. Does it make sense to store object of that class in session or I should only store userID on session and use that to Query DB? My Object will contain user details (Full name, Username et al).

Which makes more sense? If I'm not clear, please let me know. I'm trying to make usable User Management Class that I will be using in all My system for login/register and user management in general (ACL).

Thanks

Objects which can not be serialized or are composed of objects that can't be serialized will cause headaches with your sessions for starters.

In my experience there is a bigger performance hit for the server to serialize and unserialize session data than there is to recreate the objects from persistent storage, especially if the object collection grows and grows.

commented: Very useful! +6

That is very useful. It means I better create objects than "hide" them in sessions. I was having that though only with no rational reason! Thanks for that!

And what about the best way to deal with user information? Put them as attribute of object (Array) or store Id in session and Pull the rest from DB using that ID?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.