[Catalyst] BerkeleyDB session storage

Jonathan Rockway jon at jrock.us
Thu Dec 11 10:52:59 GMT 2008

Hi all,

I have been using Session::Store::FastMmap for storing sessions for a
long time.  This has caused me a lot of pain, because it turns out that
Cache::FastMmap is a *cache*, and is happy to randomly discard unexpired
sessions.  (If there are too many, one is too big, or there are too many
on the same 64k page, or ...)

Anyway, I have written Catalyst::Plugin::Session::Store::BerkeleyDB as a
drop-in replacement.  It is based on BerkeleyDB, and will never lose any
sessions (unless your disk fails).  It is safe to share between multiple
processes, and even multiple machines with the right environment setup.
It can also integrate with your existing BDB database, which is good for
KiokuDB users.  (And by default, it requires no configuration.)

The module is on the CPAN now, so please take a look at the docs if you
are interested.  Email me or the list if you have questions / problems /
patches / etc. :)

One more thing -- you might want to make sure
$c->delete_expired_sessions gets called from time to time, to make sure
that you are not keeping useless data around on disk.  A public action
hit by cron everyday should be fine.  (No harm will be done if an evil
user hits the action.)

Jonathan Rockway

print just => another => perl => hacker => if $,=$"

More information about the Catalyst mailing list