FormCache
class FormCache implements FormCacheInterface (View source)
Encapsulates the caching of a form and its form state.
Properties
| protected KeyValueExpirableFactoryInterface | $keyValueExpirableFactory | The factory for expirable key value stores used by form cache. |
|
| protected CsrfTokenGenerator | $csrfToken | The CSRF token generator to validate the form token. |
|
| protected AccountInterface | $currentUser | The current user. |
|
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
|
| protected LoggerChannelInterface | $logger | Logger channel. |
|
| protected ConfigFactoryInterface | $configFactory | The config factory. |
|
| protected RequestStack | $requestStack | The request stack. |
|
| protected RequestPolicyInterface | $requestPolicy | A policy rule determining the cacheability of a request. |
|
| protected string | $root | The app root. |
Methods
__construct(string $root, KeyValueExpirableFactoryInterface $key_value_expirable_factory, ModuleHandlerInterface $module_handler, AccountInterface $current_user, CsrfTokenGenerator $csrf_token, LoggerInterface $logger, RequestStack $request_stack, RequestPolicyInterface $request_policy)
Constructs a new FormCache.
loadCachedFormState(string $form_build_id, FormStateInterface $form_state)
Loads the cached form state.
setCache(string $form_build_id, array $form, FormStateInterface $form_state)
Stores a form in the cache.
deleteCache(string $form_build_id)
Deletes a form in the cache.
Details
__construct(string $root, KeyValueExpirableFactoryInterface $key_value_expirable_factory, ModuleHandlerInterface $module_handler, AccountInterface $current_user, CsrfTokenGenerator $csrf_token, LoggerInterface $logger, RequestStack $request_stack, RequestPolicyInterface $request_policy)
Constructs a new FormCache.
getCache(string $form_build_id, FormStateInterface $form_state)
Fetches a form from the cache.
protected
loadCachedFormState(string $form_build_id, FormStateInterface $form_state)
Loads the cached form state.
setCache(string $form_build_id, array $form, FormStateInterface $form_state)
Stores a form in the cache.
deleteCache(string $form_build_id)
Deletes a form in the cache.