Per table Live_Objects toggling

[prev] [thread] [next] [Date index for 2004/07/09]

From: Siamak Pazirandeh
Subject: Per table Live_Objects toggling
Date: 19:19 on 09 Jul 2004
Recentl I've had a need to turn on/off the Live_Objects behavior on a per table basis. I'm sharing some code here, as it may be useful to others:

You can place this code in your Class::DBI derived class. It sould be fairly benign, as far as future code changes go.




# We declare a class data accessor for turning on/off caching on a per table basis.
__PACKAGE__->mk_classdata('nocache');

# This is a override of the object caching mechanism of Class::DBI. We allow a derived class
# to say __PACKAGE__->nocache(1) and thus turn off the Live_Objects caching  on a per table basis.
sub _init { my($class) = shift;
    local $Class::DBI::Weaken_Is_Available = not $class->nocache;
    return $class->SUPER::_init(@_);
}



Max

Per table Live_Objects toggling
Siamak Pazirandeh 19:19 on 09 Jul 2004

Re: Per table Live_Objects toggling
Tim Bunce 21:43 on 10 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52