Forum OpenACS Q&A: Is PermissionCacheP robust?

Posted by Andrew Piskorski on
The OpenACS kernel (at least as of OpenACS 4.6.2) has a PermissionCacheP switch. Above, Peter and Don mentioned this back in February, and Don at least was raising potentially serious concerns of whether the implementation of PermissionCacheP was correct or even a good idea at all.

So before I start digging into the PermissionCacheP code myself, what was the conclusion of that discussion? Is PermissionCacheP now robust and a good thing, or are there still problems or concerns?

Here are a couple other threads related to caching of permissions queries, from Feb. 2003 and June 2002

Posted by Jeff Davis on
The permissions are cached just fine and properly flushed when updated in most cases (if you use the API rather than hitting the db directly that is). The problem is that if you add or remove someone from a group (or add or remove a permission on an object for a group) the cached value can then be invalid. This is the case for pretty much any inherited permission.

Properly maintaining the cache in that circumstance is very expensive and consequently no attempt is made to do it.

So the short answer is that if you have permissions set up in a particular way on your site it *might* work but but generally there are a lot of cases where the cache is out of sync with the DB. With Don's permissions checking speedup work it is hopefully not necessary for most sites anyway.