Apache::DBI::Cache::mysql - a Apache::DBI::Cache plugin
use Apache::DBI::Cache plugin=>'Apache::DBI::Cache::mysql', ...; or use Apache::DBI::Cache; use Apache::DBI::Cache::mysql;
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.
DBD::mysql
port
USE database
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.
host=server;port=3306
USE db[1-3]
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.
mysql_auto_reconnect
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 >
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 (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.
To install Apache::DBI::Cache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::DBI::Cache
CPAN shell
perl -MCPAN -e shell install Apache::DBI::Cache
For more information on module installation, please visit the detailed CPAN module installation guide.