Clean your sessions

By | | Ruby on Rails Tutorials & Articles

1

By default, Rails doesn’t nuke expired sessions from your app’s storage of choice (either PStores/files or rows in a database table, usually). On my personal site, there’s just under a million entries in the session table alone – somewhat of a waste as it keeps building over time.

To counter this, you can implement this handy code snippet via a Cron job (or run it manually if you don’t have access to Cron or similar tools, you poor poor bastich).

Written By:

Daniel Bogan

Daniel is a Sydney-based neurotic web monster, who spends most of his life buried inside Rails applications and playing video games. Sometimes at the same time. You can find him at waferbaby.com.

>> More Posts By Daniel Bogan

 

{ 1 comment }

Anonymous March 31, 2008 at 10:09 pm

Comments on this entry are closed.