Re: Class::DBI and caching

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

From: Michael Graham
Subject: Re: Class::DBI and caching
Date: 19:09 on 04 Feb 2005

> My problem is the following:
>
> 1) The user makes a request which is processed by process A
> 2) Now the next request is processed by process B, I alter a value
>     and DBI saves the data / updates the object for further usage
>     in process B
> 3) In the third request the user gets back to process A, DBI notices
>     "hey, there is the db object I need" and uses it, obviously its
>     cached data should be discarded since they are out of date.
>
> Is there any way to prevent DBI caching data (or at least trigger DBI
> to update the object without storing the discarded data which still
> reside in the object)?

Have a look at "Uniqueness of Objects in Memory" in the Class::DBI docs.

I encountered a problem in my mod_perl app where Process A loaded an
object and kept it around for multiple requests, even after Process B
made changes to the same object.

What I did was clear the object from memory at the end of the HTTP
request:

    $user->remove_from_object_index();

The Class::DBI docs imply that this shouldn't be necessary; when all
references to your object go out of scope, the object is removed from
Class::DBI's object index.

So, I'm guessing that in my case I've probably got a variable that
never goes out of scope, or a circular reference.  Maybe you do too?


Michael

--
Michael Graham <magog@xxxxxxxx.xxx>


Class::DBI and caching
Thomas Keller 15:36 on 04 Feb 2005

Re: Class::DBI and caching
Perrin Harkins 16:20 on 04 Feb 2005

Re: Class::DBI and caching
Michael Graham 19:09 on 04 Feb 2005

Re: Class::DBI and caching
Andy Grundman 22:03 on 04 Feb 2005

Re: Class::DBI and caching
Perrin Harkins 22:15 on 04 Feb 2005

Re: Class::DBI and caching
William McKee 15:09 on 07 Feb 2005

Generated at 21:37 on 09 Feb 2005 by mariachi v0.52