X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8e0ac85dcabc7bf33d2239e508a70d7cca0994b7..8809a4d1a4b4d3e5b3de31af94c0679dabfacc28:/SL/DBConnect.pm diff --git a/SL/DBConnect.pm b/SL/DBConnect.pm index 9142f1c71..369cfe158 100644 --- a/SL/DBConnect.pm +++ b/SL/DBConnect.pm @@ -4,6 +4,7 @@ use strict; use DBI; use SL::DB; +use SL::DBConnect::Cache; my %dateformat_to_datestyle = ( 'yy-mm-dd' => 'ISO', @@ -33,12 +34,18 @@ sub _connect { sub connect { my ($self, @args) = @_; + if (my $cached_dbh = SL::DBConnect::Cache->get(@args)) { + return $cached_dbh; + } + my $dbh = $self->_connect(@args); return undef if !$dbh; my $initial_sql = $self->get_initial_sql; $dbh->do($initial_sql) if $initial_sql; + SL::DBConnect::Cache->store($dbh, @args); + return $dbh; }