To delete from the cache the cache item set with `cache_set($cache_id, $temp_data, 'cache', CACHE_TEMPORARY);` it's enough to call `cache_clear_all($cache_id, 'cache');`. Despite the name, `cache_clear_all()` doesn't necessarily clear all the cache; it does so only when no parameter is passed to the function.

Usually Drupal core uses `cache_clear_all()` to clear all the cache. In some cases, it uses that function to clear a specific cache item, which is what Drupal core does in [`variable_set()`][1].

```php
function variable_set($name, $value) {
  global $conf;
  db_merge('variable')->key(array('name' => $name))
    ->fields(array('value' => serialize($value)))
    ->execute();
  cache_clear_all('variables', 'cache_bootstrap');
  $conf[$name] = $value;
}
```

In that code, the deleted cache item is the one whose cache ID is *variables*, contained in the *cache_bootstrap* cache bin.








  [1]: https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/variable_set/7.x