This repository was archived by the owner on Feb 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
7.x 2.x cache warming
Andy Truong edited this page Jan 9, 2014
·
9 revisions
To flush cached tags on some special events of Drupal, define:
# File: %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: ['view:my_view:block_1']
user_logout: []Notes:
- 'view:my_view:block_1', will warm view my_view, display ID block_1.
- %entity_type, %type
- %entity_bundle, %bundle
- %entity_id, %id
- %process:relationships: Start cache warming process on related entities with
- %uid: UID of current user
- %roles: Replace on tag to multiple tags, with context user's roles
- %taxonomy_terms: Replace one tag to multiple tags, with taxonomy-term attached to entity.
- %process:taxonomy_terms: Start cache warming process on related taxonomy term.
- %entity_references: …
- %process:entity_references: …
- %relationships: replace on tag to multiple tags, with ID if related entity.
- %process:relationships: Start cache warming process on entities has relationship on current entity.
use \Drupal\at_base\Cache\Warmer as CacheWarmer;
/**
* Implements hook_user_login()
*/
function at_base_user_logout($account) {
at_container('cache.warmer')
->setEventName('user_logout')
->setContext(array('entity_type' => 'user', 'entity' => $account))
->warm()
;
} ___ ___________ _ _
/ _ \_ _| ___ \ | | | |
/ /_\ \| | | |_/ / __ _ ___ ___ _ __ ___ ___ __| |_ _| | ___
| _ || | | ___ \/ _` / __|/ _ \ | '_ ` _ \ / _ \ / _` | | | | |/ _ \
| | | || | | |_/ / (_| \__ \ __/_| | | | | | (_) | (_| | |_| | | __/
\_| |_/\_/ \____/ \__,_|___/\___(_)_| |_| |_|\___/ \__,_|\__,_|_|\___|
- Caching
- Twig template
- twig Service
- twig_string Service
- Recipes
- Extends
- Easy Block
- Easy Routing
- Easy Breadcrumb
- Entity Template
- Drush Commands:
- Functions:
- Misc
- Status
- Tools for Development enviroment
- /devel/php improved
- /at/sql
- /at/twig
- Kint integration