[Zope3-Users] Using RAMCache

Dominique Lederer lederer.dominique at gmail.com
Tue Jul 3 07:47:52 EDT 2007


i would like to cache the results of method in a view, and thougt, that RAMCache
could be of use here.

After spending a lot of time searching for some documentation or examples, i
came to this:

from zope.app.cache.ram import RAMCache
cache = RAMCache()
query = cache.query('test',key={'x':1})
if query == None:
	result = expensive_stuff_method()
  	cache.set(result, 'test', key={'x':1})
	return result
	return query

but that won´t work, the cache looses it´s entry, if i call the browser-view again.

any hints?
thanks, Dominique

More information about the Zope3-users mailing list