An overview of Drupal's cache_clear_all uses

Drupal has a very simple, yet powerful (low level) caching system. It provides 3 functions that should please all you caching needs: cache_get, cache_set and cache_clear_all. The first two are pretty straight forward to use, but the third one might take some time to wrap your head around.
It accepts 3 argument: a cache ID, table cache and a wilcard boolean. Each combination of these 3 has a very different result. Here's an overview of all combinations.
cache_clear_all()
Passing no arguments to cache_clear_all is the same as saying the following

cache_clear_all(NULL, 'cache_block');
cache_clear_all(NULL, 'cache_page');

As you'll learn further on, this will clear all expired entries from the block and page cache. This is for example used when you update a node, update a block etc.

cache_clear_all(NULL, 'cache_TABLE')

Specifying the cache table but passing NULL for the cache ID will remove all expired entries from the specified table.

cache_clear_all('*', 'cache_TABLE', TRUE)

Specifying the cache table but passing '*' for the cache ID will remove all (expired an temporary) entries from the specified table. You will also need to specify that you're using the '*' wildcard by setting the $wildcard parameter to TRUE.

cache_clear_all('KEY_PREFIX', 'cache_TABLE', TRUE)

Specifying the cache table but passing a key prefix for the cache ID will remove all (expired an temporary) entries from the specified table whose cache ID starts with the KEY_PREFIX. You will also need to specify that you're using the prefix by setting the $wildcard parameter to TRUE.

cache_clear_all('KEY', 'cache_TABLE')

By specifying a specific cache ID and cache table (and no $wildcard), you're saying: remove that entry from the table regardless the fact that it's expired or not.