Jump to content

A simple question


jscix

Recommended Posts

I'm curious if anyone knows of any reason why persisting an object in a session could be a bad idea?

 

Besides memory usage, and if anyone can answer this, how much memory usage would I be looking at by storing an object in a session?

The object is merely a storehouse for user related data. (name, address, phone#, etc.)

 

It also contains a few methods for manipulating that data..

 

Thanks in advance.

Link to comment
Share on other sites

Why not store the data in a mysql (or sqllite?) database, then just store a reference to the row in the session?

 

You'd have to store a few other bits of info in the db to authenticate the session user, IP for starters, but when you update the info then their session merely points to the data, rather than holding it.

 

As highlander said, you cant update their session, but you can update the data it points to without having to update the session. Easier on memory, and faster too.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.