[Zope-PAS] RFC: PAS caching
Jim Fulton
jim at zope.com
Sat Oct 9 02:40:01 EDT 2004
Jens Vagelpohl wrote:
> Hi guys,
>
> I'm going to work on caching for PAS and have thought about a couple
> different architectural models to do so. I've come to a model I
> personally like and wouldn't mind some comments.
>
> Basically, I am proposing an architecture that works a little bit like
> ZCacheable in that you instantiate cache managers and associate objects
> (in this case plugins) with them. Obviously there are only a few plugin
> types where it makes sense to cache anything. Since the "cacheable"
> plugins have varying interfaces there would be specific cache manager
> objects for each of them, and only the appropriate plugin can be
> associated with them.
>
> The plugins would cache based on keys that reflect the arguments to the
> given method that is used to retrieve data and allow to set parameters
> such as cache duration and knobs to invalidate the cache.
>
> The caches require some cooperation from the plugins so that the methods
> that provide cacheable data would try to locate and consult an
> appropriate cache first, just like index_html in some basic OFS types
> now consults ZCache_get before computing a result. The interfaces itself
> would not be affected, just the implementations (which I would handle
> myself, too).
>
> What do you think?
Why isn't caching an implementation detail of the plugins? Why do we need
a more general caching infrastructure within PAS? In fact, plugins that
wanted to could use the existing Zope cache infrastructure.
Note that, based on discussions with Tres re caching, the Zope 3 PAS apis
specifically allow for caching of principals by principal factories. This
is why it is the responsibility of the cache factory to generate
principal-created events. A cache factory might cache principal instances
and only generates principal-created events when it needs to compute a new
principal.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope-PAS
mailing list