You are here

function _botcha_set_form_cache in BOTCHA Spam Prevention 6

Same name and namespace in other branches
  1. 7 botcha.botcha.inc \_botcha_set_form_cache()

BOTCHA cache functions - set, get, clear

1 call to _botcha_set_form_cache()
botcha_form_alter_botcha in ./botcha.botcha.inc
Main BOTCHA worker - process the form and apply BOTCHA protection

File

./botcha.botcha.inc, line 656
Implementation of botcha form logic.

Code

function _botcha_set_form_cache($form_build_id) {

  // 6 hours cache life time for forms should be plenty.
  $expire = 21600;
  $data = array();
  $data['#cache_token'] = _botcha_get_token();

  // We use cache_form table.
  // Sneaky, but why build our own table since we are working side-by-side with form API?
  cache_set('botcha_' . $form_build_id, $data, 'cache_form', time() + $expire);
}