For background information, see the description of cache management.
The RAM cache manager allows you to cache the result of calling expensive objects, such as Python Scripts and External Methods, in memory. It provides access statistics and simple configuration options.
Not all objects are appropriate for use with a RAM Cache Manager. See the caveats section below.
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.
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
You should generally not cache the following with RAM Cache Manager:
Although Zope does not prevent you from doing so, it generally does not make sense to associate any of these objects with a RAM cache manager. The cache will simply not cache image or file data, since the data is already available in RAM.
In addition, be careful with complete web pages. The problem is that most cacheable objects will cache only their return value; important out-of-band information such as the HTTP response code is typically not cached. For example, if you cache a page which calls RESPONSE.redirect(), a client that gets a cache hit will see an HTTP 200 response code instead of the redirect.
For all of the above objects, another kind of cache manager, an accelerated HTTP cache manager, is available and more suitable.