Per table Live_Objects toggling
[prev]
[thread]
[next]
[Date index for 2004/07/09]
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
|