diff --git a/core/lib/Drupal/Core/Form/FormCache.php b/core/lib/Drupal/Core/Form/FormCache.php index ea38fd2..963fd90 100644 --- a/core/lib/Drupal/Core/Form/FormCache.php +++ b/core/lib/Drupal/Core/Form/FormCache.php @@ -24,6 +24,11 @@ * @ingroup form_api */ class FormCache implements FormCacheInterface { + /** + * The default lifetime of the form's cache is set to 6 hours. Override + * FormCache object and set constant to a different value if needed. + */ + const FORM_CACHE_DEFAULT_LIFETIME = 21600; /** * The factory for expirable key value stores used by form cache. @@ -188,8 +193,7 @@ protected function loadCachedFormState($form_build_id, FormStateInterface $form_ * {@inheritdoc} */ public function setCache($form_build_id, $form, FormStateInterface $form_state) { - // 6 hours cache life time for forms should be plenty. - $expire = 21600; + $expire = static::FORM_CACHE_DEFAULT_LIFETIME; // Ensure that the form build_id embedded in the form structure is the same // as the one passed in as a parameter. This is an additional safety measure