Drupal doesn't invoke a hook function until I don't clean the cache I created a module, and implemented hook_form_alter() using the following code.

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'mymodule_form_id') {
    $form['#validate'] = array('mymodule_form_validate');
  }
}


Drupal can call the function correctly, and run well for several days.

But one day Drupal did not call the function anymore, until I cleared the cache. Why?
The reason why clearing the caches fixed the issue is because all hooks are cached in Drupal 7 via module_implements(). My guess is something odd happened to your cache and thus your hook went missing from the cache.