You are not logged in Log in Join
You are here: Home » Members » Martijn Faassen's Page » SimpleCache » SimpleCache Information

Log in
Name

Password

 

SimpleCache Information

SimpleCache is a very simplistic approach at caching Zope objects. You give it a producer (an object id, usually something like a DTML method), and optionally a list of dependencies, which may be the id of any other Zope object.

You can access the contents of the cache by writing something like:

  <dtml-var "cache_id.view(REQUEST)">

Or by just viewing it in the management screen or through an URL. When the producer or any of the dependencies are changed (i.e. their bobobase_modification_time() changes), the cache will detect this and will automatically be updated as soon as you try to view it. You can also manually update the cache by pressing the Change button in the cache management screen.

You will have to add the ids of all the dependent objects to the SimpleCache yourself. This means that if you forget a dependency and it changes, your cache won't update. Currently only full fledged Zope objects can be a dependency. Properties for instance are out. Form variables are out. Database query results are definitely out. SimpleCache is only suitable for relatively static pages.

SimpleCache also supports a debug mode. If you enable it, you will able to see if your page is coming from the cache or not: the phrase [cached by 'cache_id'] should appear at the top of the page (possibly in the source, depending on your HTML).