Apache-DBI-Cache
view release on metacpan or search on metacpan
The other logger is used when running under mod_perl. It is mainly
controlled by the Apache "LogLevel" setting. Messages at level 0
are printed as "$log->error", level 1 as "$log->info" and level 2
as "$log->debug". For level 2 messages additionally the current
debug level is checked to be greater or equal 2.
* delimiter
Here the internal key delimiter can be changed. It defaults to
"\1". Changing it is necessary only when your DSN, username or
password contain it or to provide more readable debugging
messages.
statistics
returns a reference to the statistics hash. If BerkeleyDB is used it
is tied to BerkeleyDB::Btree.
statistics_as_html
returns a reference to an array of HTML fragments. If mod_perl and
Apache::Status or Apache::Status2 is used the output of this
function is shown under http://HOST/STATUS/URI?DBI_conn.
lib/Apache/DBI/Cache.pod view on Meta::CPAN
The other logger is used when running under mod_perl. It is mainly controlled
by the Apache C<LogLevel> setting. Messages at level 0 are printed as
C<< $log->error >>, level 1 as C<< $log->info >> and level 2 as
C<< $log->debug >>. For level 2 messages additionally the current debug
level is checked to be greater or equal 2.
=item * B<delimiter>
Here the internal key delimiter can be changed. It defaults to C<\1>.
Changing it is necessary only when your DSN, username or password contain
it or to provide more readable debugging messages.
=back
=item B<statistics>
returns a reference to the statistics hash. If BerkeleyDB is used it is
tied to L<BerkeleyDB::Btree>.
=item B<statistics_as_html>
lib/Apache/DBI/Cache/mysql.pm view on Meta::CPAN
require DBD::mysql;
Apache::DBI::Cache::plugin
(
'mysql',
sub { # Idx generator $ctx
my ($dsn, $user, $passwd, $attr)=@_;
$Apache::DBI::Cache::LOG->(3, "mysql plugin: got dsn=$dsn");
$attr={%{$attr||{}},
'user' => $user,
'password' => $passwd,
};
DBD::mysql->_OdbcParse($dsn, $attr,
['database', 'host', 'port']);
if( exists $attr->{host} ) {
$attr->{port}=3306 unless( exists $attr->{port} );
}
$attr->{AutoCommit}=1 unless( exists $attr->{AutoCommit} );
$dsn=join(';',
map( {length $attr->{$_}
? $_."=".$attr->{$_}
: ()} (qw/host port/)));
my $ctx={};
$ctx->{database}=$attr->{database} if( length $attr->{database} );
($user, $passwd)=delete @{$attr}{qw/user password host port database/};
$Apache::DBI::Cache::LOG->(3, "mysql plugin: returning dsn=$dsn");
return ($dsn, $user, $passwd, $attr, $ctx);
},
sub { # connection reinit: issue 'use db'
my ($dbh, $dsn, $user, $passwd, $attr, $ctx)=@_;
if( exists $ctx->{database} ) {
$Apache::DBI::Cache::LOG->(3, "mysql plugin: use database $ctx->{database}");
my $rc=eval {
$dbh->{mysql_auto_reconnect}=0;
( run in 1.174 second using v1.01-cache-2.11-cpan-49f99fa48dc )