siraj has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I am trying to change the session storage from DB ( Apache::Session::Oracle) to Memcache ( Apache::Session::Memcached). I am able to create a session through Apache::Session::Memcached, but I don't know how to get/set/clear session from memory. Also how do i see list of sessions at any point.
Kindly suggest me some good docs/samples .

Regards,
Siraj
  • Comment on Migrating Apache session from DB to Memcached

Replies are listed 'Best First'.
Re: Migrating Apache session from DB to Memcached
by moritz (Cardinal) on Mar 21, 2011 at 12:27 UTC

    Leaving aside that memcached is a caching solution, and thus IMHO not suited for data that you want to persist even if your cache is full... The fine documentation shows a tied hash - thus you can store things by assigning to hash items, and retrieve them just as you would with an ordinary hash.

    $session{foo} = 'bar'; say $session{foo};
    Also how do i see list of sessions at any point.

    Maybe with keys, just as you would with an ordinary array. But I don't know if that's implemented, after all memcached is a cache, not a database. It is certainly not optimized for getting all the datasets out at once.