Private Tempstore - Store data on Drupal 9 session
This method allow to store data on drupal session using drupal session table (not php $_SESSION).
Storage is different for each users ans each visitors if anonymous
This method allow to store data on drupal session using drupal session table (not php $_SESSION).
Storage is different for each users ans each visitors if anonymous
sudo apt-get update && sudo apt-get upgrade
sudo apt install redis-server
sudo apt install php-redis
sudo systemctl status redis-server
redis-cli ping
If you want to disable cache for a custom controller (Custom module), You have no_cache option (YOUR_MODULE.routing.yml).
Example :
File : mymodule.routing.yml
Drupal 8 shiped with a powerfull cache API able to set cache according to a context. correct usage of this cache improve the site preformence greatly.
https://www.drupal.org/docs/8/api/cache-api/cache-contexts
https://www.drupal.org/node/2451661
Memcache is caching server allow you to incrise and have great performence on your site. Drupal and memcached work very well and here the full tutorial you need to install and setup memcache server and your drupal instance.
Get the default cache bin
$cache = \Drupal::cache();
To get a particular cache bin (here 'render'):
$render_cache = \Drupal::cache('render');
Cache configuration of a renderer array (Just an exaple)
This system allow you to invalidate drupal cache using a 'tag'
Exapples:
1. Go to Administration > Configuration > Development > Performance
(/admin/config/development/performance)
2. Click on "Clear all caches"
drush cache-rebuild
OR
drush cr
In addition to the Step 2, Just add $form['#cache']['disabled'] = TRUE;
$form['#cache']['max_age'] = 0;