HTTP::Session::Store::DBI - store session data in DBI for L


HTTP-Session-Store-DBI documentation  | view source Contained in the HTTP-Session-Store-DBI distribution.

Index


NAME

Top

HTTP::Session::Store::DBI - store session data in DBI for HTTP::Session

SYNOPSIS

Top

    use HTTP::Session;

    my $session = HTTP::Session->new(
        store   => HTTP::Session::Store::DBI->new( {
            dbh => ["dbi:SQLite:dbname=xxx", '', '', {RaiseError => 1}]
        } ),
        state => ...,
        request => ...,
    );

DESCRIPTION

Top

store session data in DBI. read HTTP::Session for usage.

CONFIGURATION

Top

dbh

ArrayRef which passes to DBI->connect(@$_)

or Instance of DBI->connect

expires

session expire time(in seconds)

sid_table

the table name where session stores. default is 'session'

sid_col

the session_id column name. default is 'sid'

data_col

the data column name. default is 'data'

expires_col

the expires column name. default is 'expires'

clean_thres

default is '0.001'. because DBI do NOT delete expired data itself, we have code in sub delete

    if ( rand() < $self->clean_thres ) {
        my $time_now = time();
        $dbh->do(qq~DELETE FROM $sid_table WHERE expires < $time_now~);
    } 

set it to 0 if we do NOT want it.

TABLE SQL

Top

SQLite:

    CREATE TABLE session (
        sid          VARCHAR(32) PRIMARY KEY,
        data         TEXT,
        expires      INTEGER UNSIGNED NOT NULL,
        UNIQUE(sid)
    );

METHODS

Top

select
update
delete
insert

for internal use only

SEE ALSO

Top

HTTP::Session, DBI

AUTHOR

Top

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Top


HTTP-Session-Store-DBI documentation  | view source Contained in the HTTP-Session-Store-DBI distribution.