Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

7.x 2.x cache warming

Andy Truong edited this page Jan 7, 2014 · 9 revisions

To flush cached tags on some special events of Drupal, define %your_module/config/cache_warming.yml

tags:
  entity_update: ['my_tag_1', 'my_tag_2']
  enttiy_delete: ['%entity_type:%entity_bundle:%entity_id', '%type:%bundle:%id']
  user_login: []
  user_logout: []

To define your own event:

use \Drupal\at_base\Cache\Warmer as CacheWarmer;

/**
 * Implements hook_user_login()
 */
function at_base_user_logout($account) {
  $warmer = new CacheWarmer('user_logout');
  $warmer->setEntity('user', $account);
  $warmer->warm();
}

Clone this wiki locally