Problem/Motivation

My site has 21 roles, however only 4 of them actually a large change to the site. All the other roles only change what type of entities the users can create/edit. The only differences between most of the 17 other roles is the contents of a few blocks being changed. Authcache requires that for a page to be cacheable to a user that all roles they have must be cacheable. This creates an unnecessarily large cache creating more keys than needed causing performance degredation as mentioned in #2478217: Display a performance warning if more than 10 roles are enabled

Proposed Resolution

Add configuration that tells authcache to ignore roles.

User Interface Changes

On Auth cache configuration page add list of check boxes to mark roles to ignore.

Comments

electrocret’s picture

electrocret’s picture

Issue summary: View changes
znerol’s picture

Status: Active » Postponed

You can reduce the amount of duplicated cache entries by customizing the authcache key as described in Authcache 2 tuning guide - optimize cache-hit ratio. If you use the Authcache Enum module, you need to also implement a role combination function matching that logic. See the documentation of _authcache_enum_default_role_combine() for more information.

I do not think there is a safe way to implement such a feature generically. Therefore I most probably will not put any effort in making this configurable from the UI.

drone.ah’s picture

We combine caches using the hook_authcache_key_properties_alter, and merging roles together. For example, role1 and role2 are ignored from the list. Do roles role1 and role2 still need to be enabled for caching? or are the roles checked *after* the key_properties alter?

znerol’s picture

Re #4 caching is only turned on if every single role of a user is cacheable. This logic is independent of the cache key calculation. If you want users having role1 and/or role2 to profit from the cache, you must enable caching for those roles - regardless of whether or not you customize the authcache key.

znerol’s picture

Status: Postponed » Closed (works as designed)