[Zope-CMF] Chnages to ram-cache manager and CMF ?

Tim Hoffman timhoffman@cams.wa.gov.au
08 May 2002 12:36:35 +0800


Hmm

OK I know understand why it is failing (weel up to a point)
previously I had always cached the results of scripts
that returned lists of simple strings.

I am now returning a sorted/filtered list of brains and the following
code in RAMCacheManager

def __init__(self, index, data, view_name):
        try:
            # This is a protective barrier that hopefully prevents
            # us from caching something that might result in memory
            # leaks.  It's also convenient for determining the
            # approximate memory usage of the cache entry.
            self.size = len(dumps(index)) + len(dumps(data))
        except:
            raise CacheException('The data for the cache is not
pickleable.')

is barfing because dumps is raising an exception when trying to 
pickle a list of brains. This is unfortunate, as caching the page
that uses this list doesn't help because I am only showing 
a small set of the list on each page.

Hmm, any ideas on why brains wouldn't be picklable, or
for that matter why it would be unsafe to cache brains
as the cache manager is just using the dumps operation 
as a saftey net, it doesn't actually do anything with the pickle.

Rgds

Tim


On Wed, 2002-05-08 at 11:48, Tim Hoffman wrote:
> Hi 
> 
> I am running a CVS snapshot of CMF as of 19/4/2002.
> 
> I am finding that the results of python scripts don't seem 
> to being cached by the ram cache manager, 
> ie they are associated, the are seen in the statistics page
> but no results are ever cached, ie all columns have a value of 0.
> 
> I can successfully cache the pagetemplate that calls the script
> 
> I have noticed there is now a CMF Caching policy tool which seems
> to have something to do with skin methods, any likely hood
> this could have an affect
> 
> previous use of this approach with CMF1.2 worked fine.
> 
> Any thoughts, hints 
> 
> Rgds
> 
> Tim
> 
> 
> 
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature requests