I've created a small helper where I can set and access my session variable (thanks to the drupal 8 session).
Can't figure out why, my session is working well with my dev (no cache) but on my prod my session is not persisted, need to refresh drupal cache to see my session variable...
public static function getSessionIRA()
{
return self::getModuleStore()->get('session_ira');
}
public static function setSessionIRA($session_ira)
{
return self::getModuleStore()->set('session_ira', $session_ira);
}
/**
* @return mixed
*/
private static function getModuleStore()
{
return \Drupal::request()->getSession();
return self::$module_store = \Drupal::service('user.private_tempstore')->get('mymodule_services');
}
UPDATE:
I had to add my development settings on my production website, but I believe that it's not recommanded... How can I avoid this ?
See my config below on my prod environment
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: false
auto_reload: true
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory