function _authcache_enum_default_role_combine in Authenticated User Page Caching (Authcache) 7.2
Default enumeration method for authcache keys.
Default method for enumerating possible combinations of roles. Each item is an array with one or more role-ids forming a role-combination.
This approach will build an array with 2^n elements. If you enable more than a couple of roles (say 10) in authcache, then memory consumption and computation time will rise quickly.
In order to override this function with your own implementation, set the variable authcache_enum_role_combine to the desired function, e.g. in settings.php:
$conf['authcache_enum_role_combine'] = '_my_function';
2 string references to '_authcache_enum_default_role_combine'
- authcache_enum_authcache_enum_key_property_info in modules/
authcache_enum/ authcache_enum.module - Implements hook_authcache_enum_key_property_info().
- authcache_enum_requirements in modules/
authcache_enum/ authcache_enum.install - Implements hook_requirements().
File
- modules/
authcache_enum/ authcache_enum.module, line 153 - Provides methods for computing and enumerating authcache keys
Code
function _authcache_enum_default_role_combine() {
module_load_include('inc', 'authcache_enum', 'authcache_enum.comb');
$roles = authcache_get_roles();
$choices = array();
// Anonymous users do not have any authcache-key. Therefore there is no need
// to include this role in the property-info.
unset($roles[DRUPAL_ANONYMOUS_RID]);
// The authenticated-user role is exclusive, only include it once. Do not
// generate combinations including this role.
if (isset($roles[DRUPAL_AUTHENTICATED_RID])) {
$choices[] = array(
DRUPAL_AUTHENTICATED_RID,
);
unset($roles[DRUPAL_AUTHENTICATED_RID]);
}
// Combine remaining roles.
$roles = array_keys($roles);
sort($roles);
return array_merge($choices, _authcache_enum_comb($roles));
}