CREATE TABLE sessions (
id CHAR(32) NOT NULL UNIQUE,
a_session TEXT NOT NULL,
expires int unsigned NOT NULL
);
####
sub store {
my ($self, $sid, $options, $data) = @_;
my $dbh = $self->MySQL_dbh($options);
my $lck_status = $dbh->selectrow_array(qq|SELECT GET_LOCK("$sid", 10)|);
unless ( $lck_status == 1 ) {
$self->error("Couldn't acquire lock on id '$sid'. Lock status: $lck_status");
return undef;
}
$dbh->do(qq|REPLACE INTO $TABLE_NAME (id, a_session, expires) VALUES(?,?,?)|, undef, $sid, $self->freeze($data),$self->expire() + $self->atime());
return $dbh->selectrow_array(qq|SELECT RELEASE_LOCK("$sid")|);
}
####
$dbh->do("delete from sessions where expires",undef,time());