I've checked in a preliminary implementation of the proposed new_or_cached() Rose::DB class method. No docs or tests yet, and debugging is enabled by default. Please give it a spin and tell me if it's useful.
I've made the cache class replaceable. The default cache class is Apache::DBI-aware. The proposed init_db() method to use with it in your Rose::DB::Object-derived base class is something like this: BEGIN: { if($ENV{'MOD_PERL'}) { *init_db = sub { EVA::DB->new_or_cached }; } else # act "normally" when not under mod_perl { *init_db = sub { EVA::DB->new }; } } Under Apache::DBI, this setup will conspire to: * cache all Rose::DB-derived objects, with the type and domain as the cache keys. * use a single Rose::DB-derived object per type/domain pair and a single DBI $dbh connection per set of connection params during server startup. * discard all DBI $dbh connections created during server start-up once the server is up and running. * discard all DBI $dbh connections contained in cached Rose::DB-derived objects at the end of each request, forcing DBI->connect() to be called the first time a $dbh is requested at the beginning of the next request, triggering Apache::DBI's ping()ing functionality. I put in code for mod_perl 1 and 2, but I only have version 1 here. MP2 users, please test and let me know if it works for you. SVN is at: https://rose.svn.sourceforge.net/svnroot/rose/trunk/modules/Rose-DB -John ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object