Views in Drupal 8 automatically adds cache tags to every view so that their content can be invalidated when it changes (and can be cached as long as possible until they do).

However, Drupal 8 only has a single list cache tag for every entity type. Every view that lists nodes is tagged with node_list and will be invalidated when a node is added, changed or deleted.

Views usually have filters. They might list nodes of a specific type, or nodes that are tagged with a certain term and a combination of three other filters. By using more specific cache tags, it is possible to only update views that actually might list the changed node.

This module replaces the hardcoded cache tag with a form that allows developers to set different cache tags based on configuration of the view. It is also possible to set cache tags based on arguments/contextual filters.

The module does not yet invalidate any of those cache tags automatically. It requires custom code that does that, for example like this:

function yourmodule_node_presave(NodeInterface $node) {
  $tags = ['mysite:node:' . $node->getType()];
  if ($node->hasField('field_category')) {
    $tags[] = 'mysite:node:category:' . $node->field_category->target_id;


The module is in an early phase and will likely be extended in the future, for example with functionality to invalidate cache tags based on configuration.


  • A views cache plugin that allows to configured the added cache tags
  • Support for setting cache tags based on passed in arguments


Views Custom Cache Tags was built for D8. There will be no back port.


Further documentation will follow.

Supporting organizations: 
Initiation, Architecture, Implementation, Maintenance

Project information