| 1 | package Apache::Session::SQLite3; | ||
| 2 | 1 | $Apache::Session::SQLite3::VERSION = '0.03'; | |
| 3 | |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use base 'Apache::Session'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | ▶ | use DBD::SQLite 1.00; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use Apache::Session; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Apache::Session::Lock::Null; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use Apache::Session::Store::SQLite3; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use Apache::Session::Generate::MD5; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use Apache::Session::Serialize::Storable; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 2 | ▶ | sub populate { |
|
Subroutine
populate: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 15 | 2 | my $self = shift; | |
| 16 | |||
| 17 | 2 | $self->{object_store} = Apache::Session::Store::SQLite3->new($self); | |
| 18 | 2 | $self->{lock_manager} = Apache::Session::Lock::Null->new($self); | |
| 19 | 2 | $self->{generate} = \&Apache::Session::Generate::MD5::generate; | |
| 20 | 2 | $self->{validate} = \&Apache::Session::Generate::MD5::validate; | |
| 21 | 2 | $self->{serialize} = \&Apache::Session::Serialize::Storable::serialize; | |
| 22 | 2 | $self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize; | |
| 23 | |||
| 24 | 2 | return $self; | |
| 25 | } | ||
| 26 | |||
| 27 | 1 | 1; | |
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | Apache::Session::SQLite3 - Use DBD::SQLite 1.x for Apache::Session storage | ||
| 32 | |||
| 33 | =head1 VERSION | ||
| 34 | |||
| 35 | This document describes version 0.03 of Apache::Session::SQLite3, released | ||
| 36 | February 2, 2005. | ||
| 37 | |||
| 38 | =head1 SYNOPSIS | ||
| 39 | |||
| 40 | use Apache::Session::SQLite3; | ||
| 41 | |||
| 42 | tie %hash, 'Apache::Session::SQLite3', $id, { | ||
| 43 | DataSource => 'dbi:SQLite:dbname=/tmp/session.db' | ||
| 44 | }; | ||
| 45 | |||
| 46 | # to purge all sessions older than 30 days, do this: | ||
| 47 | tied(%hash)->{object_store}{dbh}->do(qq[ | ||
| 48 | DELETE FROM Sessions WHERE ? > LastUpdated | ||
| 49 | ], {}, time - (30 * 86400)); | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | This module is an implementation of Apache::Session. It uses the DBD::SQLite | ||
| 54 | backing store. It requires DBD::SQLite version 1.00 or above, due to its use | ||
| 55 | of SQLite3 API for BLOB support. Also, an extra C<LastUpdated> field is | ||
| 56 | populated with the current C<time()>. | ||
| 57 | |||
| 58 | There is no need to create the data source file beforehand; this module creates | ||
| 59 | the C<session> table automatically. | ||
| 60 | |||
| 61 | =head1 AUTHOR | ||
| 62 | |||
| 63 | Autrijus Tang E<lt>autrijus@autrijus.orgE<gt> | ||
| 64 | |||
| 65 | =head1 COPYRIGHT | ||
| 66 | |||
| 67 | Copyright 2004, 2005 by Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>. | ||
| 68 | |||
| 69 | This program is free software; you can redistribute it and/or modify it | ||
| 70 | under the same terms as Perl itself. | ||
| 71 | |||
| 72 | See L<http://www.perl.com/perl/misc/Artistic.html> | ||
| 73 | |||
| 74 | =head1 SEE ALSO | ||
| 75 | |||
| 76 | L<Apache::Session>, L<Apache::Session::SQLite>, L<DBD::SQLite> | ||
| 77 | |||
| 78 | =cut | ||