Please forgive this discussion, but I’m not sure where to find what I’m looking for.
I’m coming for a PHP background, where I’ve only ever used sessions for very simple storage (serializing when I need a lil’ more structure). Also I’ve been using the PHP sessions, which PHP is responsible for cleaning up.
After reading Agile Web Development Development, they made some suggestions:
- Don’t store data in the session, but have a separate structure that you reference with the session ID
- Store sessions in the database.
This poses some questions:
- Can you implement some sort of session cleaning solely through Ruby without the need for a CRON job?
- With this clean up (or even with a cron job) how does one handle the associated data in the database? How do we prevent these from being orphaned, since their session is now gone. Eg. in the book, I think they were talking about cart information. If you had each cart stored in the database and referenced by a session id, how do we ensure that that cart gets deleted when the user’s session expires or is cleaned?
- How does Rails 2.0 and the default Cookie based session storage help/hurt the above? I take it there’s no cleanup? Still, how do we clean the associated data?
Any help would be much appreciated.
Please bare with the ignorance.
ThanX in advance guys.