Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Our site has an awful lot of roles for authenticated users, but 90% of them are irrelevant in terms of cache keys. I have crafted a small patch to the ESI module that allows the set of roles that are incorporated into the hash to be configurable in the settings. The default is still to include all roles.
For more advanced cases, I've also added drupal_alter() hooks into the role and user hashing functions for other modules to do fancier decisions on which roles matter.
Hope you like it! Wonderful module by the way...
Comment | File | Size | Author |
---|---|---|---|
#1 | esi-1447350-1-roles-whitelist.patch | 2.92 KB | mikeytown2 |
esi-rolewhitelist.patch | 2.31 KB | neilnz |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedThanks. This patch has been committed. I've just added more documentation to your patch.
http://drupalcode.org/project/esi.git/commit/33237454ab5f92dfbd840a544cb...
Comment #3
manarth CreditAttribution: manarth commented7.x-3.x contains an alternative implementation: you can use hook_esi_context() to introduce a new limited-role context, or hook_esi_context_alter() to change the role context and remove the irrelevant roles.