diff --git a/includes/common.inc b/includes/common.inc index 20cc82b..864f581 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6258,6 +6258,12 @@ function drupal_render_cache_by_query($query, $function, $expire = CACHE_TEMPORA * @code * DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE * @endcode + * Carefully consider exactly what can cause the content of your block to + * change. If you choose too general a granularity then you could end up + * serving the wrong content, but if you are too specific then you could end + * up with a very large cache and low hit rate, which could actually reduce + * performance. In particular, DRUPAL_CACHE_PER_USER can be very + * resource-consuming on sites with many users. * * @return * An array of cache ID parts, always containing the active theme. If the @@ -6277,16 +6283,12 @@ function drupal_render_cid_parts($granularity = NULL) { } if (!empty($granularity)) { - // 'PER_ROLE' and 'PER_USER' are mutually exclusive. 'PER_USER' can be a - // resource drag for sites with many users, so when a module is being - // equivocal, we favor the less expensive 'PER_ROLE' pattern. if ($granularity & DRUPAL_CACHE_PER_ROLE) { $cid_parts[] = 'r.' . implode(',', array_keys($user->roles)); } - elseif ($granularity & DRUPAL_CACHE_PER_USER) { + if ($granularity & DRUPAL_CACHE_PER_USER) { $cid_parts[] = "u.$user->uid"; } - if ($granularity & DRUPAL_CACHE_PER_PAGE) { $cid_parts[] = $base_root . request_uri(); }