NAME
EasySession - Perl Session Interface
SYNOPSIS
use EasySession;
if(defined(&EasySession::foo)){
print "lib is included";
}else{
print "lib is not included";
}
#{"_sid" => "B43b648fd431aac32", "a" => 1, "b" => 2}
print EasyTool::dump(create($dba,{a=>1,b=>2,c=>undef},{expire=>300}));
$dba->execute('START TRANSACTION');
my $st=CORE::time();
for(1..10000){
create($dba,{a=>1,b=>2,c=>undef},{});
}
print CORE::time()-$st;
$dba->execute('COMMIT');
print EasyTool::dump(&delete($dba,{"_sid" => "43ba09e0abd5cf13", "a" => 1, "b" => 2}));
print EasyTool::dump(&delete($dba,"43ba08a74fbe7afa"));
print EasyTool::dump(&save($dba,{"_sid" => "43ba08a74fbe7afa", "a" => 1, "b" => 2,"c"=>3}));
The synopsis above only lists the major methods and parameters.
Basic Variables and Functions
Variables
$dba: instance of EasyDBAccess
$rh : the hash_ref to store to database
$session: $rh with key _sid
$sid: session id ([0-9a-fA-F]{8})([0-9a-fA-F]{8})
$rc : affected rows 0 or 1
$rh_option:
now => unix timestamp of now
expire => expire time after last modify
ip => ip address (int)
Functions
$session=create($dba,$rh,$rh_option);
$session=load($dba,$sid,$rh_option);
$rc =save($dba,$session,$rh_option);
#if succ return 1,if fail(no row update) return 0
#if record exist, then update, else do nothing
$rc =delete($dba , $sid|$session [,$rh_option]);
#if succ return 1,if fail(no row delete) return 0
#if record exist, then delete, else do nothing
COPYRIGHT
The EasySession module is Copyright (c) 2003-2005 QIAN YU. All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.