[Zope] Invalidate RAM cahce manager programatically

Jim Kutter jim at ebizq.net
Thu Oct 9 11:38:57 EDT 2003


Ok here's what I was doing wrong.

What I neglected to mention was that I am also using a ZCatalog to kind
of cache SQL results, and facilitate searching. The catalog is what
returns the SQL results to the script for rendering. 

What I discovered was that calling catalog_object doesn't re-catalog the
SQL results like I thought it would. I had to uncatalog_object first,
then catalog_object to have the changes from the database kick in. I
presumed that multiple calls to catalog_object would overwrite the
ZCatalog's entry with new data.

Thanks mucho for everyone's help.

-jim

-----Original Message-----
From: Jim Kutter 
Sent: Thursday, October 09, 2003 10:55 AM
To: Dan Pierson
Cc: zope at zope.org
Subject: RE: [Zope] Invalidate RAM cahce manager programatically


I found the Zcachable_invalidate call yesterday after my first post, but
I couldn't get it working properly, and figured it was the wrong way to
go.

What's happening is that even after invalidating it, it still appears to
be cached. The value is changed in the database. I suspect I'm running
into a double-caching issue with the SQL methods too. Does the presence
of a ram cache manager affect the SQL method's caching techniques? Or is
it completely separate?

-jim

-----Original Message-----
From: Dan Pierson [mailto:dan at control.com] 
Sent: Thursday, October 09, 2003 10:29 AM
To: Jim Kutter
Subject: RE: [Zope] Invalidate RAM cahce manager programatically


No, you've picked a good tree :-)  For each cached item
that you want to invalidate, call ZCacheable_invalidate().

For example, if you have something (dtml, python script,
page template?) named 'cacheable_article'.  Invoke 

  cacheable_article.ZCacheable_invalidate()

Now if you want to do this for multiple ZEO clients the
problem gets harder.  I came up with my own crude invalidation server
that ran in parallel to the ZEO server.  Jim Fulton suggested that I
could just hack the ZEO server protocol to carry my invalidation
messages as well as its.  I looked into it but was more than a bit
terrified at the thought of messing with the ZEO protocol and
maintaining the result.

On Thu, 2003-10-09 at 09:41, Jim Kutter wrote:
> I'm trying to speed up parts of our site, and I want to use cache
> managers (no sense rendering the same results over and over if they
> don't change often), but my editor wants to have changes go live
> immediately.
> 
> I have python scripts that pull SQL results, and displays them nicely.
> What I want is when my editor inserts/edits/deletes an item, the
script
> knows to refresh. Otherwise that item remains until the script gets
too
> old in the cache.
> 
> Am I barking up the wrong tree here?
> 
> -jim
> 
> -----Original Message-----
> From: Chris Withers [mailto:chrisw at nipltd.com] 
> Sent: Thursday, October 09, 2003 9:30 AM
> To: Jim Kutter
> Cc: zope at zope.org
> Subject: Re: [Zope] Invalidate RAM cahce manager programatically
> 
> 
> Jim Kutter wrote:
> 
> > Is it possible to invalidate the whole RAM cache manager 
> > programatically? For that matter, how would I invalidate just one
> entry 
> > as the result of a form action?
> 
> Why do you want to?
> 
> Chris
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
-- 
Dan Pierson <dan at control.com>


_______________________________________________
Zope maillist  -  Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )



More information about the Zope mailing list