[Catalyst] Q: Delete old session data

Bernhard Graf catalyst4 at augensalat.de
Mon Jan 25 14:22:39 GMT 2010

Tomas Doran schrieb:

> Deleting all the expired sessions from within a web hit is a bad idea,
> as you're going to have to do an arbitrary amount of work, taking an
> arbitrary amount of time... (There may be several _MILLION_ files to
> delete in an extreme case).

I know, I know. Of course such tasks don't belong in a HTTP request
loop. I'm just asking to be sure that I'm not missing some clever
feature here. ;-)
Look at Apache::Session::Counted for a file system based session module
with (optional) implicit garbage collection.

> I'd recommend just crontabbing find /tmp/session_dir -mtime +2 | xargs
> rm or something similar.. (I'd probably wrap this in a script which is a
> bit smarter and reports / deals with failure better etc, but you get the
> idea)..

So if C:P:S:Store::File doesn't honour any expiration information your
suggestion makes sense.

Bernhard Graf

More information about the Catalyst mailing list