RAM Cache Managers

For background information, see the description of cache management.

The RAM cache manager allows you to cache the result of calling DTML methods, Python scripts, and SQL methods in memory. It allows you to cache entire pages as well as parts of pages. It provides access statistics and simple configuration options.

Storing the result in memory results in the fastest possible cache retrieval, but carries some risks. Unconstrained, it can consume too much RAM. And it doesn't reduce network traffic, it only helps Zope return a result more quickly.

Fortunately, RAM cache managers have tunable parameters. You can configure the threshold on the number of entries that should be in the cache, which defaults to 1000. Reduce it if the cache is taking up too much memory or increase it if entries are being cleared too often.

You can also configure the cleanup interval. If the RAM cache is fluctuating too much in memory usage, reduce the cleanup interval.

Finally, you can configure the list of REQUEST variables that will be used in the cache key. This can be a simple and effective way to distinguish requests from authenticated versus anonymous users or those with session cookies.

If you find that some of your objects need certain cache parameters while others need somewhat different parameters, create multiple RAM cache managers.

The Statistics tab allows you to view a summary of the contents of the cache. Click the column headers to re-sort the list, twice to sort backwards. You can use the statistics to gauge the benefit of caching each of your objects. For a given object, if the number of hits is less than or not much greater than the number of misses, you probably need to re-evaluate how that object is cached.

Although Zope does not prevent you from doing so, it generally does not make sense to associate an image or a file object with a RAM cache manager. It will not cache the image or file data, since the data is already available in RAM. However, another kind of cache manager, an accelerated HTTP cache manager, is available and is suitable for images and file objects.