This package provide a pluggable cache support for Silva related components, base on Beaker. By default content will be cached in memory, but you can use a different storage like files, memcache or an SQL database to store cached content.

For a single instance installation we recommand to use memory as storage. For a ZEO / multi Zope instance installation we recommand to use memcache as storage.

To use memcache recommend to install pylibmc, this can be done via buildout. Please refer to the installation documentation of Silva for this.

After you can configure in your Zope configuration (zope.conf) which storage to use for which regions:

<product-config silva.core.cache>

    # default region
    default.lock_dir /tmp/memcache
    default.type ext:memcached
    default.url localhost:11211

    # shared region
    shared.lock_dir /tmp/memcache
    shared.type ext:memcached
    shared.url someotherhost:11211



Developers have different tools at their disposal, mainly:

Decorator that can be used on a class method to cache its computation. It can take a region which specify which caching region to use, a key which is a callable, taking as parameter the class on which the method is called to compute a caching key. If region is not specified, all other parameters are Beaker options used to configured the cache manager used.
Decorator that can be used on a class to create a read-only property where its computation is cached in Beaker. Except for key it takes the same parameters than cached_method.
Giving a cache name, it give a dictionnary like access to this cache.
Constructed out of a request, it is a dictionnary like access to a unique cache for this user session. The session is identified with the help of the adapter IClientId of zope.session. An implementation of this adapter for Zope 2 is done in this package.
A global utility provides this interface to give you access to all cache managers used by this extension.
Store a list of items in memcache.

Code repository

The code for this extension can be found in Mercurial at:

Available releases

Release version Release date Release files
silva.core.cache 3.0.2 Mar 6, 2013 12:22:29 PM silva.core.cache-3.0.2.tar.gz
silva.core.cache 3.0.1 Sep 24, 2012 12:40:24 PM silva.core.cache-3.0.1.tar.gz
silva.core.cache 3.0 Nov 8, 2011 5:14:58 PM silva.core.cache-3.0.tar.gz
silva.core.cache 2.3.3 Jul 27, 2011 10:11:36 AM silva.core.cache-2.3.3.tar.gz
silva.core.cache 2.3.2 Oct 27, 2010 3:37:38 PM silva.core.cache-2.3.2.tar.gz
silva.core.cache 2.3.1 Oct 18, 2010 12:17:42 PM silva.core.cache-2.3.1.tar.gz
silva.core.cache 2.3 Oct 6, 2010 5:06:20 PM silva.core.cache-2.3.tar.gz
silva.core.cache 2.1 Sep 20, 2011 11:01:55 AM silva.core.cache-2.1.tar.gz

License: New BSD