views:

11

answers:

1

I need to track some information on users, but would like to retain it for a fixed time period, say a week.

If I set this value via request.sessions, and the user logs out, can I retrieve it if they log back in later? This all assumes that my sessions are normally set to expire in 30 days, if the user neVer logs out.

While thinking about the above problem, I decided to store the data in a table, but I would still like to know the answer to above for referenCe. I also decided not to use cookies due to unreliability.

+1  A: 

It would depend on your session backend. But the default backend (backends.db) does delete the row from the sessions table when you log out.

I would recommend adding the data to a field in the user profile. Using the session will give problems even if you don't delete the data. The next time the user logs in you won't know which session id he/she used the last time and normally you only have the session id to look up. Not a user id so you can get all sessions owned by a specific user.

WoLpH