Ram Caching under Zope 3 - The return from the cache

I thaught this would be very complicated to set up memory caching in Zope 3, as I needed a tool that would be enough low level to be integrated into my objects.

Thread safeness... availabilty... _v_ prefix to avoid .....

But it's very simple in fact :

from zope.app.cache.ram import RAMCache

collection_name = 'BigObjects'
my_super_cache = RAMCache()

# caching
object_to_cache = BigObjectJustInRam()
my_super_cache.set(object_to_cache, 'unique_key', collection_name)

object_to_cache2 = BigObjectJustInRam()
my_super_cache.set(object_to_cache2, 'unique_key_2', collection_name)


# retrieving
the_return_from_the_cache = my_super_cache.query(collection_name, 'unique_key')
the_return_from_the_cache2 = my_super_cache.query(collection_name, 'unique_key_2')

# empty cache
my_super_cache.invalidate(collection_name)






Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior.

Like this post? Share it:


Trackback Pings

Trackback URL for this entry:
http://blogs.nuxeo.com/sections/blogs/tarek_ziade/2005_03_02_ram_caching_under_zope_3/tbping
Posted by Tarek Ziadé @ 03/02/2005 12:11 AM. - Categories: five, zope3 -  0 comments

Nuxeo Bloggers: Log in!
Nuxeo - Indesko - Nuxeo 5 Project
All content is copyrighted by their author.
CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS.