You are here

function node_render_cache_entity_hash_alter in Render cache 7

Same name and namespace in other branches
  1. 7.2 modules/controller/render_cache_entity/render_cache_entity.module \node_render_cache_entity_hash_alter()

Implements hook_render_cache_entity_hash_alter().

Parameters

array $hash:

object $entity:

array $cache_info:

array $context:

File

./render_cache.module, line 404
Hook implementations and frequently used functions for render cache module.

Code

function node_render_cache_entity_hash_alter(&$hash, $entity, $cache_info, $context) {

  // We generally cache nodes based on comment count.
  if ($context['entity_type'] == 'node' && isset($entity->comment_count)) {

    // @todo This is very unreliable if comments can be edited, it would be better
    //       to directly save a list of entity_modified values but entity_modified
    //       needs to support multiple get and caching for that first.
    $hash['node_comment_count'] = $entity->comment_count;
  }
}