[Zope] Re: Programmatically flushing entries from RAM cache?

Florent Guillaume fg at nuxeo.com
Thu Dec 15 05:39:44 EST 2005


John Barham wrote:
> Is it possible to flush a path w/ a specific argument from a RAM cache
> from a Python script?
> 
> Here's my situation:  I have a script FolderExists() that takes a
> single "path" argument and, after running an SQL query, returns True
> or False if the folder path exists or not in the database.  Since the
> database query is relatively expensive, I want to cache its result in
> RAM.  However, if a folder is created (using another Python script in
> the same Zope instance) I want to flush the cached result for the path
> (i.e., I don't want to flush all of the cached entries for the
> FolderExists method if that can be avoided).

Unfortunately no, it's a deficiency of the simple RAMCacheManager: you can't 
invalidate a key individually, you have to invalidate them all. Changing 
this is probably not too complex, and is (low) on my TODO list (at position 
approx. 136 ;)).

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list