NetSDS::Session(3) memcached based session storage API


use NetSDS::Session;
# Connecting to Memcached server
my $sess = NetSDS::Session->new(
host => '',
port => '12345',
# Retrieve session key somehow
$session_key = $cgi->param('sess_key');
my $filter = $sess->get('filter');
$sess->set('filter', $new_filter);


"NetSDS::Session" module provides API to session data storage based on Memcached server.

Each session represented as hash reference structure identified by UUID string. Most reasonable usage of this module is a temporary data storing for web based GUI between HTTP requests. However it's possible to find some other tasks.

Internally session structure is transformed to/from JSON string when interacting with Memcached.


new(%params) - class constructor
Constructor establish connection to memcached server and set default session parameters.


        * host - memcached server hostname or IP address (default:
        * port - memcached server TCP port (default: 11211)


        my $sess_hdl = NetSDS::Session->new(
                host => '',
                port => '99999',
open($sess_id) - open session
Retrieve session data from server by session key (UUID string)

If no session exists then empty hashref is returned.

id() - get session id
Returns current session id.


        my $sess_id = $sess->id();
set($key, $value) - set session parameter
Set new session parameter value identified by it's key.


        $sess->set('order', 'id desc');
get($key) - get session parameter
Return session parameter value by it's key.


        my $order = $sess->get('order');
delete($key) - delete session parameter by key
Delete session parameter by it's key.

Returns updated session data as hash reference.


clear() - clear session data
This method clears all session data.


sync() - save session
Synchronize session data on Memcached server.


close() - save and close session
This method save all data to server and clear current session id and data from object.




Michael Bochkaryov <[email protected]>


Yana Kornienko - for initial module implementation


Copyright (C) 2008-2009 Net Style Ltd.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA