[CDBI] mod_perl problems

Perrin Harkins pharkins at gmail.com
Sun Feb 25 15:27:58 GMT 2007


On 2/24/07, Bill Hess <bhess at techrg.com> wrote:
> We are using MySQL
>
> Have not checked the isolation level - not sure what this means but will
> research it against the CDBI docs and try to do so...

Isolation level refers to how your database handles transactions.  If
you're using InnoDB, you will probably want to change it to be more
relaxed than the default.
http://perl.apache.org/docs/1.0/guide/databases.html#Transactions_Not_Committed_with_MySQL_InnoDB_Tables

> > $Class::DBI::Weaken_Is_Available = 0;
> I made this change and this seems to fix my problem!  Thanks!

Good.  The bad news is that means you have objects that never go out
of scope.  That's why they were retaining their values.

> This setting will not allow me to take advantage of the index cache for
> any of my objects.

There is no cache.  The live objects index just prevents you from
creating two copies of the same database row in memory.  It doesn't
prevent database trips.

> Also - besides not using the index cache - are there any other issues
> with setting $Class::DBI::Weaken_Is_Available = 0;
> with mod_perl for example more memory usage than normal, etc...

No.

> Is there a way to pick and choose which objects use the index cache?

Again, there is no cache.  If you want one, look at one of the modules
that provides caching on CPAN, like Class::DBI::Sweet.  If you want to
turn off the objects uniqueness feature on a class-by-class basis, you
can do that by overriding _live_object_key() to return undef.

- Perrin



More information about the ClassDBI mailing list