[Dbix-class] Caching connections

Matt S Trout dbix-class at trout.me.uk
Sun Apr 30 17:05:34 CEST 2006


Dan Horne wrote:
> As far as I can tell from the DBIC code, allowances are made for Apache::DBI
> under mod_perl,

Actually that code isn't making allowances, it's doing its level best to 
disable Apache:;DBI due to all the problems caused by it :)

 > but I'd like similar consideration for FastCGI and
> PersistentPerl and I think my problem is solved via DBI's connect_cached.
> Matt, perhaps my logic is all wrong, and I'm missing something fundamental -
> I'm still trying to assimilate all of the DBIC documentation. 

Mmmm. I think I'd create a $schema per user on-demand and persist it. 
connect_cached is imperfect IMO. Alternatively, you could pass ->connect a 
subref returning a $dbh instead of a connect string, which would let you do 
pretty much anything you wanted to get the dbh.

I'm afraid this isn't a use case I've given much thought to; I tend to handle 
security at the application level and have a single db connection for the app 
(or in odd cases two, one for reading and a higher-privilege one for writing).

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list