form_set_cache
Definition
form_set_cache($form_build_id, $form, $form_state)
includes/form.inc, line 220
Description
Store a form in the cache.
Related topics
| Name | Description |
|---|---|
| Form generation | Functions to enable the processing and display of HTML forms. |
Code
<?php
function form_set_cache($form_build_id, $form, $form_state) {
global $user;
// 6 hours cache life time for forms should be plenty.
$expire = 21600;
if ($user->uid) {
$form['#cache_token'] = drupal_get_token();
}
cache_set('form_'. $form_build_id, $form, 'cache_form', time() + $expire);
if (!empty($form_state['storage'])) {
cache_set('storage_'. $form_build_id, $form_state['storage'], 'cache_form', time() + $expire);
}
}
?> 