Skip to main content

Presentation

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

</product-config>

API

Developers have different tools at their disposal, mainly:

silva.core.cache.descriptors.cached_method

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.

silva.core.cache.descriptors.cached_property

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.

silva.core.cache.store.Store

Giving a cache name, it give a dictionnary like access to this cache.

silva.core.cache.store.SessionStore

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.

silva.core.cache.interfaces.ICacheManager

A global utility provides this interface to give you access to all cache managers used by this extension.

silva.core.cache.memcacheutils.MemcacheSlice

Store a list of items in memcache.

Code repository

The code for this extension can be found in Git at: https://github.com/silvacms/silva.core.cache

Changes

3.0.2 (2013/03/06)

  • Session cookie now uses IVirtualSite new top level path method instead of root path, ensuring the cookie is set for the whole site.

3.0.1 (2012/09/24)

  • Session cookie use the HTTPOnly flag now.

  • Update API to match Silva 3.0c1.

3.0 (2011/11/08)

  • Add a memcache slice to store a list of items in memcache. There is a fallback available if you don’t have memcache.

  • Improve cache descriptors.

2.3.2 (2010/10/27)

  • Ensure caching keys are always string. This is required by memcache implementations.

2.3.1 (2010/10/18)

  • Fix cookie path for cookie session in case of virtual host hosting.

2.3 (2010/10/06)

  • Initial release.

Metadata

Release files for silva.core.cache 3.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for silva.core.cache 3.0.2
File Size Uploaded
silva.core.cache-3.0.2.tar.gz 11.6 kB Details

Release files / silva.core.cache-3.0.2.tar.gz

Download URL silva.core.cache-3.0.2.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2a57224b923254ae235602409dcbd41da656d869385defdcdf62ad6991d42a31
BLAKE2b-256 checksum
How to use checksums
83bedfa283906c530e6eadaecdc0d2b2c26a5843a2fe21645e0662ad08de0743
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

3.0.2 This release

1 release file

2.3.3

1 release file

2.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page