On 5/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
On May 23, 2006, at 3:52 PM, John Siracusa wrote:
The benefits of having a Manager for a ::Cached class are dubious.
Unless you
plan to save() (or remember() or forget()) some of the objects returned by
the Manager, it doesn't really matter whether the Manager's object_class is
::Cached or not.

well in this case I want want to preload an entire table using cached - as
you suggested

its my naive understanding that in order to load everything ( ie, no
primary key ) i need to use a manager

since i need to load via a manager and save cached, it seems like a need a
cached version of manager

Yeah, that's one way to do it.  But remember that
make_manager_methods() takes an object_class parameter, so you can
also use just one Manager class and then make two sets of methods:
cached and non-cached.

   # Make regular manager methods
   PDQ::Product::Manager->make_manager_methods(
     base_name    => 'products',
     object_class => 'PDQ::Product');

   # Make cached manager methods
   PDQ::Product::Manager->make_manager_methods(
     base_name    => 'cached_products',
     object_class => 'PDQ::Product::Cached');
   ...

   $products = PDQ::Product::Manager->get_cached_products();
   foreach my $p (@$products) { $p->remember }

In fact, most of the Rose::DB::Object::Manager methods take an
object_class parameter.  All make_manager_methods() really does is
make wrappers for those methods with hard-coded object_class values.
So yet anther way to do this is to call get_objects() directly and
pass an object_class parameter.

   $products =
     PDQ::Product::Manager->get_objects(
       db           => PDQ::DB->new(...),
       object_class => 'PDQ::Product::Cached');

Many ways to skin this cat, as usual... :)

-John


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to