Submit handler that explicitly clears cache_example_files_count from cache.

Related topics

1 string reference to 'cache_example_form_expire_files'
cache_example_page_form in cache_example/cache_example.module
Main page for cache_example.

File

cache_example/cache_example.module, line 183
Outlines how a module can use the Cache API.

Code

function cache_example_form_expire_files($form, &$form_state) {

  // Clear cached data. This function will delete cached object from cache bin.
  //
  // The first argument is cache id to be deleted. Since we've provided it
  // explicitly, it will be removed whether or not it has an associated
  // expiration time. The second argument (required here) is the cache bin.
  // Using cache_clear_all() explicitly in this way
  // forces removal of the cached item.
  cache_clear_all('cache_example_files_count', 'cache');

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