Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Blocache (Block Cache Control)

Security covered Under active development 845 sites

This module allows website administrators to easily adjust the cache settings for individual blocks directly through the administrative interface. It provides a user-friendly way to configure cache metadata like expiration time, contexts, and tags without needing to write custom code.

Summary: this module allows website builders to change the block cache metadata through the administrative block interface (see attached images). Learn more about cache metadata here.

- - - - - -

In Drupal 8, blocks, as well as pages, are built from the idea of ​​rendering arrays. Rendering arrays determine what is shown to the user. Therefore, arrays also determine how cacheable an answer is. This is done using the #cache key, for example:

$build = [
  ...
  '#cache' => [
    'max-age' => 600,
    'tags' => ['user: administer'],
    'contexts' => ['user'],
  ],
  ...
];



Cacheability metadata consists of 3 properties: 

max-age — for time-sensitive caching, i.e. time dependencies;
contexts — for variations, i.e. dependencies on the request context;
tags — for dependencies on data managed by Drupal, like entities & configuration.

Core modules and community modules determine the values ​​for this metadata. In addition, Drupal currently does not provide the possibility to change block cache metadata from the graphical interface, only by implementing specific hooks.

If you do not like the default set, you can install this module and easily change the settings through the graphical interface. After installing this module, the configuration form for each block will display a set of fields called Cache Settings, where you can configure the cache metadata as you see fit.

Installation

Install as you would normally install a contributed Drupal module, for example:

$ composer require 'drupal/blocache:^2.0'

View Installing Modules for further information.

Maintainers

Developed and maintained by:

Drupal 9–10 · not 11 PHP 8.1

Ask your assistant about Blocache (Block Cache Control)

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • block Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Jan 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
2.0.0 Stable 9–10 PHP 8.1 Feb 22, 2023
2.0.0-rc1 Pre-release 9–10 PHP 7.1 Jan 30, 2023
2.0.x-dev Dev 9–11 PHP 8.1 Jan 20, 2023