Data::Session::Driver::Memcached - A persistent session manager


Back to Top


NAME

the Data::Session::Driver::Memcached manpage - A persistent session manager

Back to Top


Synopsis

See the Data::Session manpage for details.

Back to Top


Description

the Data::Session::Driver::Memcached manpage allows the Data::Session manpage to manipulate sessions the Cache::Memcached manpage.

To use this module do both of these:

o Specify a driver of type Memcached, as Data::Session -> new(type => 'driver:Memcached ...')
o Specify a cache object of type the Cache::Memcached manpage as Data::Session -> new(cache => $object)

See scripts/memcached.pl.

Back to Top


Case-sensitive Options

See Case-sensitive Options in the Data::Session manpage for important information.

Back to Top


Method: new()

Creates a new object of type the Data::Session::Driver::Memcached manpage.

new() takes a hash of key/value pairs, some of which might mandatory. Further, some combinations might be mandatory.

The keys are listed here in alphabetical order.

They are lower-case because they are (also) method names, meaning they can be called to set or get the value at any time.

o cache => $object

Specifies the object of type the Cache::Memcached manpage to use for session storage.

This key is normally passed in as Data::Session -> new(cache => $object).

This key is mandatory.

o verbose => $integer

Print to STDERR more or less information.

Typical values are 0, 1 and 2.

This key is normally passed in as Data::Session -> new(verbose => $integer).

This key is optional.

Back to Top


Method: remove($id)

Deletes from storage the session identified by $id.

Returns the result of calling the the Cache::Memcached manpage method delete($id).

This result is a Boolean value indicating 1 => success or 0 => failure.

Back to Top


Method: retrieve($id)

Retrieve from storage the session identified by $id.

Returns the result of calling the the Cache::Memcached manpage method get($id).

This result is a frozen session. This value must be thawed by calling the appropriate serialization driver's thaw() method.

the Data::Session manpage calls the right thaw() automatically.

Back to Top


Method: store($id, $data, $time)

Writes to storage the session identified by $id, together with its data $data. The expiry time of the object is passed into the set() method of the Cache::Memcached manpage, too.

Returns the result of calling the the Cache::Memcached manpage method set($id, $data, $time).

This result is a Boolean value indicating 1 => success or 0 => failure.

Note: $time is 0 for sessions which don't expire. If you wish to pass undef or 'never', as per the the Cache::Memcached manpage documentation, you will have to subclass the Cache::Memcached manpage and override the set() method to change 0 to 'never'.

Back to Top


Method: traverse()

There is no mechanism (apart from memcached's debug code) to get a list of all keys in a cache managed by memcached, so there is no way to traverse them via this module.

Returns 1.

Back to Top


Installing memcached

        Get libevent from http://www.monkey.org/~provos/libevent/
        I used V 2.0.8-rc
        ./configure
        make && make verify
        sudo make install
        It installs into /usr/local/lib, so tell memcached where to look:
        LD_LIBRARY_PATH=/usr/local/lib
        export LD_LIBRARY_PATH
        Get memcached from http://memcached.org/
        I used V 1.4.5
        ./configure --with-libevent=/usr/local/lib
        make && make test
        sudo make install
        Running memcached:
        memcached -m 5 &

Back to Top


Support

Log a bug on RT: https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session.

Back to Top


Author

the Data::Session manpage was written by Ron Savage <ron@savage.net.au> in 2010.

Home page: http://savage.net.au/index.html.

Back to Top


Copyright

Australian copyright (c) 2010, Ron Savage.

        All Programs of mine are 'OSI Certified Open Source Software';
        you can redistribute them and/or modify them under the terms of
        The Artistic License, a copy of which is available at:
        http://www.opensource.org/licenses/index.html

Back to Top

 Data::Session::Driver::Memcached - A persistent session manager