[Zope-PAS] PAS Caching (sucks)
chrism at plope.com
Sat Jul 29 11:02:10 EDT 2006
On Jul 29, 2006, at 10:28 AM, Jens Vagelpohl wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Even though I am the perpetrator, I think the current way of
> caching, using ZCacheable and RAM cache managers, is absolutely
> horrific. It's cumbersome to set up and the ZCacheable API is ugly
> as sin using it from code. I think simplification is needed.
> I personally don't see any need to have caching in plugins
> themselves. Instead, caching should be applied at the "gateway"
> into the user folder, where it emits user objects. These user
> objects should be cached as a whole. I am envisioning a thread-
> independent cache (meaning no redundant lookups in each thread)
> that is configured using a caching ZMI tab on the PAS instance. No
> more Cache tab everywhere and no more RAM cache managers to
> configure. And no more contortions in plugin code to utilize
> This model is the exact same model used in the LDAPUserFolder
> itself. The caching mechanism in the LDAPUserFolder contains two
> thread-independent "bags" where unwrapped users are stored: One
> exclusively for user objects generated from "passwordless" lookups,
> such as calls to getUser or getUserById and friends, and those
> generated by lookups that provide passwords. In this particular
> application having two user caches is simply an artifact of my
> slight abuse of getUser, so it might end up different in PAS.
> Who's got an opinion?
Hmmm.. PAS' trunk PluggableAutheService class already inherits from
OFS.Cacheable and its _findUser method uses the available cache, so
it seems like what you want when you say "caching should be applied
at the 'gateway' into the user folder, where it emits user objects"
already works. "Thread independence" is a property of
You do still need to configure the PAS instance to actually do
caching. But this seems OK. I think you can just ignore caching
when creating plugins if this is all you want. Even though the
ZCacheable API sucks, the indirection here is good. I wouldn't want
PAS itself to have a hard-wired caching implementation in it, and I
don't mind associating the PAS instance with a cache manager.
More information about the Zope-PAS