John Siracusa wrote on 10/27/07 12:18 PM: > Er, wasn't the original point of new_or_cached() to return a > preexisting Rose::DB object, not a new Rose::DB object with a > preexisting $dbh? Maybe I'm mis-remembering... >
I'm not sure what you had in mind when you suggested new_or_cached(). I think it was ambiguous in the original email thread, and at the time, the idea of caching Rose::DB objects was new to me. My existing caching code (from which I adapted the first patch I sent for Rose::DB and which I posted to the list several month ago) just worried about caching the DBI handles. Had I known about connect_cached() I would have just used that instead. (I was coming from a different, home-grown ORM where TTL was important for some now-irrelevant technical reasons.) I don't really see the point of caching Rose::DB objects myself. They're cheap to create, compared to DBI handles, and the only use I can see in caching them is to make use of the DBI handle they hold. In which case, why not just use the DBI caching mechanism instead. Perrin originally suggested connect_cached() as a solution to a transaction bug w.r.t Apache::DBI: http://thread.gmane.org/gmane.comp.lang.perl.modules.dbi.rose-db-object/2303/focus=2304 Seems like the latest patch I sent achieves that with new_or_cached(). But maybe the method name is what is misleading, since it suggests a 'new or cached Rose::DB object'. Maybe new_with_cached_dbh() or even: new( use_cached_dbh => 1 ) And maybe make use_cached_dbh a register-able config option. All that's really necessary is to call DBI->connect_cached() rather than DBI->connect(). That part seems pretty simple to me and ought to be a feature rather than requiring everyone who wants it to override init_dbh() in their local Rose::DB subclass. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ------------------------------------------------------------------------- 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