Re: Question about the Object Cache

[prev] [thread] [next] [Date index for 2005/04/21]

From: Perrin Harkins
Subject: Re: Question about the Object Cache
Date: 17:00 on 21 Apr 2005
On Thu, 2005-04-21 at 17:41 +0100, Ian McDonald-ONLINE wrote:
> I had assumed that the Class::DBI object cache

There is no cache...

> Then I put Carp::cluck statements after all the Class/DBI.pm execute
> statements and found that the same ActiveClass->retrieve(217) statement
> was being called multiple times from different contexts.

Yes, it is not intended to save any database lookups.  It is not a
cache.

> So what happens if the object is in memory, but not in scope?

Objects that are out of scope don't stay in memory.

> My code
> takes this form, but makes mutliple calls to ActiveRecord->retrieve(id)
> ... and those multiple calls result in multiple calls to DBI->execute.
> Is this the behavious you would expect?

Yes.

> $x->{activeRecord} = retrieve ActiveRecord (id);

Beware, indirect object syntax will bite you some day.

- Perrin

Question about the Object Cache
Ian McDonald-ONLINE 16:41 on 21 Apr 2005

Re: Question about the Object Cache
Perrin Harkins 17:00 on 21 Apr 2005

Generated at 09:29 on 27 Apr 2005 by mariachi v0.52