X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/SL/DB/Helper/Cache.pm diff --git a/SL/DB/Helper/Cache.pm b/SL/DB/Helper/Cache.pm new file mode 100644 index 000000000..e93b551d2 --- /dev/null +++ b/SL/DB/Helper/Cache.pm @@ -0,0 +1,44 @@ +package SL::DB::Helper::Cache; + +use strict; +use warnings; + +use Carp; + +use parent qw(Rose::DB::Cache); + +sub prepare_db { + my ($self, $db, $entry) = @_; + + if (!$entry->is_prepared) { + # if this a dummy kivitendo dbh, don't try to actually prepare this. + if ($db->type =~ /KIVITENDO_EMPTY/) { + return; + } + + $entry->prepared(1); + } + + if (!$db->dbh->ping) { + $db->dbh(undef); + } +} + +1; + +__END__ + +=head1 NAME + +SL::DB::Helper::Cache - database handle caching for kivitendo + +=head1 DESCRIPTION + +This class provides database cache handling for kivitendo running +under FastCGI. It's based on Rose::DBx::Cache::Anywhere. + +=head1 METHODS + +=head2 prepare_db( I, I ) + +Overrides default method to always ping() dbh.