form_set_cache

Definition

form_set_cache($form_build_id, $form, $form_state)
drupal/includes/form.inc, line 236

Description

Store a form in the cache

Related topics

Namesort iconDescription
Form generationFunctions to enable the processing and display of HTML forms.

Code

function form_set_cache($form_build_id, $form, $form_state) {
  // 6 hours cache life time for forms should be plenty.
  $expire = 21600;
  global $user;
  if ($user->uid) {
    $form['#cache_token'] = drupal_get_token();
  }
  cache_set('form_' . $form_build_id, $form, 'cache_form', REQUEST_TIME + $expire);
  if (!empty($form_state['storage'])) {
    cache_set('storage_' . $form_build_id, $form_state['storage'], 'cache_form', REQUEST_TIME + $expire);
  }
}