[Zope] Re: Problem with Python Script in RAM Cache

Tres Seaver tseaver at zope.com
Fri Oct 8 11:21:43 EDT 2004


Peter Baeuerle wrote:
> I wanted to cache a Python script in the ZOPE ram cache manager, but it did not
> work. I did hear that "RAM cache manager can only cache picklable objects". I do
> not understand, what that means. I heard that a dictionary would be a
> "picklable" object.
> My script returns a sequence (actually the results from a search in the PLONE
> catalog by the searchresults method). Does that mean, I would have to change my
> python script so that it would return a dictionary instead of a sequence to be
> able to be cached by a ram cache manager?
> Can anybody help me? 

The "sequence of result objects" is a Lazy{Filter,Map,Cat} of catalog 
brains objects;  the brains objects can't be pickled.

Have you thought about using a TopicIndex for your complex query?  It 
has better performance than caching, because it computes whether an 
object matches your query *once* (actually, each time you recatalog the 
object).

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com



More information about the Zope mailing list