cache_clear_all

Definition

cache_clear_all($cid = NULL, $wildcard = false)
includes/bootstrap.inc, line 244

Description

Expire data from the cache.

Parameters

$cid If set, the cache ID to delete. Otherwise, all cache entries that can expire are deleted.

$wildcard If set to true, the $cid is treated as a substring to match rather than a complete ID.

Code

<?php
function cache_clear_all($cid = NULL, $wildcard = false) {
  if (empty($cid)) {
    db_query("DELETE FROM {cache} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time());
  }
  else {
    if ($wildcard) {
      db_query("DELETE FROM {cache} WHERE cid LIKE '%%%s%%'", $cid);
    }
    else {
      db_query("DELETE FROM {cache} WHERE cid = '%s'", $cid);
    }
  }
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.