form_set_cache
- Versions
- 6 – 7
form_set_cache($form_build_id, $form, $form_state)
Store a form in the cache.
Related topics
Code
includes/form.inc, line 371
<?php
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['build_info']) || !empty($form_state['storage'])) {
$data = array(
'build_info' => $form_state['build_info'],
'storage' => $form_state['storage'],
);
cache_set('form_state_' . $form_build_id, $data, 'cache_form', REQUEST_TIME + $expire);
}
}
?>Login or register to post comments 