Memcached based session storage \s-1api\s0
use NetSDS::Session; # Connecting to Memcached server my $sess = NetSDS::Session->new( host => '12.34.56.78', port => '12345', ); ... # Retrieve session key somehow $session_key = $cgi->param('sess_key'); $sess->open($session_key); my $filter = $sess->get('filter'); ... $sess->set('filter', $new_filter); ... $sess->close(); 1;
\*(C`NetSDS::Session\*(C' module provides \s-1API\s0 to session data storage based on Memcached server.
Each session represented as hash reference structure identified by \s-1UUID\s0 string. Most reasonable usage of this module is a temporary data storing for web based \s-1GUI\s0 between \s-1HTTP\s0 requests. However it's possible to find some other tasks.
Internally session structure is transformed to/from \s-1JSON\s0 string when interacting with Memcached.
Constructor establish connection to memcached server and set default session parameters. Parameters: * host - memcached server hostname or IP address (default: 127.0.0.1) * port - memcached server TCP port (default: 11211) Example: my $sess_hdl = NetSDS::Session->new( host => '12.34.56.78', port => '99999', );
Retrieve session data from server by session key (\s-1UUID\s0 string) If no session exists then empty hashref is returned.
Returns current session id. Example: my $sess_id = $sess->id(); Set new session parameter value identified by it's key. Example: $sess->set('order', 'id desc');
Return session parameter value by it's key. Example: my $order = $sess->get('order');
Delete session parameter by it's key. Returns updated session data as hash reference. Example: $sess->delete('order');
This method clears all session data. Example: $sess->clear();
Synchronize session data on Memcached server. Example: $sess->sync();
This method save all data to server and clear current session id and data from object. Example: $session->close();
Cache::Memcached::Fast - \s-1XS\s0 implementation of Memcached \s-1API\s0
\s-1JSON\s0 - \s-1JSON\s0 encoding/decoding \s-1API\s0
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 \s-1GNU\s0 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 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details.
You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111-1307 \s-1USA\s0