NAME
Apache::DBI::Cache::mysql - a Apache::DBI::Cache plugin
SYNOPSIS
use Apache::DBI::Cache plugin=>'Apache::DBI::Cache::mysql',
...;
or
use Apache::DBI::Cache;
use Apache::DBI::Cache::mysql;
DESCRIPTION
NOTE: Read Apache::DBI::Cache before.
DBD::mysql
allows many different DSN syntaxes for connecting to the same database server and the same database. This plugin transforms them to a standard format thus allowing better DBI handle caching. Further, if port
is omitted the standard port 3306 is inserted. The actual database is deleted from the DSN and replaced by a USE database
command.
So, DBI connects to the following DSNs as the same user at different times are actually performed with the same DSN host=server;port=3306
. Subsequently USE db[1-3]
commands are issued before passing the handle to the caller.
dbi:mysql:dbname=db1;host=server
dbi:mysql:db2:server:3306
dbi:mysql:port=3306;database=db3;host=server
Apache::DBI::Cache can cache them all under the same key. So only one real database connection is needed instead of 3 without the plugin.
Furthermore, mysql_auto_reconnect
is turned off.
SEE ALSO
AUTHOR
Torsten Foertsch, <torsten.foertsch@gmx.net>
With suggestions from
-
Andreas Nolte < andreas dot nolte at bertelsmann dot de >
-
Dietmar Hanisch < dietmar dot hanisch at bertelsmann dot de > and
-
Ewald Hinrichs < ewald dot hinrichs at bertelsmann dot de >
SPONSORING
Sincere thanks to Arvato Direct Services (http://www.arvato.com/) for sponsoring this module and providing a test platform with several thousand DBI connections.
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Torsten Foertsch
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.