1 cache_example.module cache_example_form_expire_files($form, &$form_state)

Submit handler that explicitly clears cache_example_files_count from cache.

Related topics

File

modules/examples/cache_example/cache_example.module, line 190
Hooks implementation for the Cache Example module.

Code

function cache_example_form_expire_files($form, &$form_state) {
  // Clear cached data. This will delete the cached object from cache bin.
  //
  // Alternatives to this implementation are:
  // - use the shortcut: cache_clear_all('cache_example_files_count', 'cache');
  // - use deleteMultiple(), which is of course most useful if providing
  //   multiple cache IDs: cache('cache')->deleteMultiple(array('cache_example_files_count'));
  cache('cache')->delete('cache_example_files_count');

  // Display message to the user.
  backdrop_set_message(t('Cached data key "cache_example_files_count" was cleared.'), 'status');
}