You are not logged in Log in Join
You are here: Home » Members » itamar » CachingZWiki » CachePolicies » wikipage_view

Log in
Name

Password

 
 
FrontPage »

CachePolicies

CachePolicies are one way of organizing and controlling both fine-grained caching at the object level and simple page-level caching. You create a Cache Policy (or Cache Manager) in a folder and associate it with one or more objects, in a fashion similar to the relationship between Database Connections and ZSQLMethods.

A Cache Policy/Manager is simply an object which provides the CacheManagerInterface, so it can provide any UI and behavior its designer cares to create. A simple one might have no UI, and merely add fixed caching headers to its clients if they are the request target. A complex one might allow you to specify minimum and maximum TTL, whether to cache to memory, a file, or an external helper application, and what role the authenticated user must have in order for caching to occur!

It would be great if associating a Cache Manager with a CacheableObject could simply involve checking off names in the Contents tab of a Folder, and choosing "Assign Cache Manager". On the other hand, the Cache Manager object could provide an interface for choosing Cacheables.

If you wanted to deliberately flush some objects from the cache, you could go to their controlling Cache Manager and do so through its interface. For some objects, you might choose a Cache Manager whose objects' cached renderings only expire when flushed manually.

A default CacheStorage would be helpful, as would a default CacheableObject picker.