You are here

function MemcacheStoragePageCache::clear in Memcache Storage 7

Implements DrupalCacheInterface::clear().

Overrides MemcacheStorage::clear

File

./memcache_storage.page_cache.inc, line 78
Provides class for memcached data handling within cache_page bin.

Class

MemcacheStoragePageCache
Class handles memcached cache objects.

Code

function clear($cid = NULL, $wildcard = FALSE) {

  // If enabled memcache storage external page cache we only may delete cache by key.
  // This is because memcached doesn't support deletion by wildcard.
  if (MEMCACHE_STORAGE_EXTERNAL_PAGE_CACHE && !empty($cid) && !$wildcard) {

    // Convert string to an array to reduce amount of 'if-else' sections.
    if (!is_array($cid)) {
      $cid = array(
        $cid,
      );
    }

    // Remove HTML page from the cache_page bin.
    foreach ($cid as $cache_id) {
      MemcacheStorageAPI::delete($cache_id, $this->bin);
    }
  }

  // Process cache deletion as usual.
  return parent::clear($cid, $wildcard);
}