[Dbix-class] Caching connections
Dan Horne
dan.horne at redbone.co.nz
Sun Apr 30 21:51:25 CEST 2006
From: Matt S Trout [mailto:dbix-class at trout.me.uk]
> connect_cached is imperfect IMO.
Oh. What's wrong with it?
? 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 didn't know I could do that!
> 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).
>
It's not for security - it's for transactional safety. Consider a case where
user A starts a longish (5 second) transaction, and user B starts one
shortly after, but it fails immediately and rolls back - well this would
roll back A's transaction too if the same database handle was used.
Dan
More information about the Dbix-class
mailing list