Re: Per table Live_Objects toggling

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

From: Tim Bunce
Subject: Re: Per table Live_Objects toggling
Date: 21:43 on 10 Jul 2004
I have planned for a while to "refactor" (to use a fashionable phrase)
the caching code to provide greater control per-class.

Though it may not happen till after the conference.

I also want to let the dust settle on the scoping/refcount perl-bug
that's been raised recently.

Tim.

On Fri, Jul 09, 2004 at 12:19:14PM -0700, Siamak Pazirandeh wrote:
> 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