Apache2-ASP
view release on metacpan or search on metacpan
lib/Apache2/ASP/CacheManager.pm view on Meta::CPAN
#==============================================================================
sub retrieve
{
}# end retrieve()
#==============================================================================
sub verify_cache_id
{
}# end verify_cache_id()
1;# return true:
lib/Apache2/ASP/SessionStateManager.pm view on Meta::CPAN
local $^W = 0;
__PACKAGE__->set_db('Main',
$conn->dsn,
$conn->username,
$conn->password
);
# Prepare our Session:
if( my $id = $s->parse_session_id() )
{
if( $s->verify_session_id( $id ) )
{
$s->{SessionID} = $id;
return $s->retrieve( $id );
}
else
{
$s->{SessionID} = $s->new_session_id();
$s->write_session_cookie();
return $s->create( $s->{SessionID} );
}# end if()
lib/Apache2/ASP/SessionStateManager.pm view on Meta::CPAN
}
else
{
return;
}# end if()
}# end parse_session_id()
#==============================================================================
# Returns true if the session exists and has not timed out:
sub verify_session_id
{
my ($s, $id) = @_;
my $range_start = time() - ( $s->context->config->data_connections->session->session_timeout * 60 );
local $s->db_Main->{AutoCommit} = 1;
my $sth = $s->db_Main->prepare_cached(<<"");
SELECT COUNT(*)
FROM asp_sessions
WHERE session_id = ?
AND modified_on BETWEEN ? AND ?
$sth->execute( $id, time2iso($range_start), time2iso() );
my ($active) = $sth->fetchrow();
$sth->finish();
return $active;
}# end verify_session_id()
#==============================================================================
sub create
{
my ($s, $id) = @_;
local $s->db_Main->{AutoCommit} = 1;
my $sth = $s->db_Main->prepare_cached(<<"");
INSERT INTO asp_sessions (
lib/Apache2/ASP/SessionStateManager/Memcached.pm view on Meta::CPAN
#==============================================================================
sub new
{
my ($class, %args) = @_;
my $s = bless { }, $class;
# Prepare our Session:
if( my $id = $s->parse_session_id() )
{
if( $s->verify_session_id( $id ) )
{
$s->{SessionID} = $id;
return $s->retrieve( $id );
}
else
{
$s->{SessionID} = $s->new_session_id();
$s->write_session_cookie();
return $s->create( $s->{SessionID} );
}# end if()
lib/Apache2/ASP/SessionStateManager/Memcached.pm view on Meta::CPAN
$s->{memd} ||= new Cache::Memcached {
'servers' => [
split(/,\s*/, $s->context->config->data_connections->session->dsn )
]
};
$s->{memd};
}# end memd()
#==============================================================================
sub verify_session_id
{
my ($s, $SessionID) = @_;
defined( $s->memd->get( $SessionID ) );
}# end verify_session_id()
#==============================================================================
sub retrieve
{
my ($s, $SessionID) = @_;
my $got = $s->memd->get( $SessionID );
$got->{memd} = $s->memd;
$got = bless $got, ref($s) || $s
( run in 2.005 seconds using v1.01-cache-2.11-cpan-5467b0d2c73 )