You are here

public function BaseMemcacheProfilerStorage::purge in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\BaseMemcacheProfilerStorage::purge()

Purges all data from the database.

Overrides ProfilerStorageInterface::purge

File

vendor/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php, line 108

Class

BaseMemcacheProfilerStorage
Base Memcache storage for profiling information in a Memcache.

Namespace

Symfony\Component\HttpKernel\Profiler

Code

public function purge() {

  // delete only items from index
  $indexName = $this
    ->getIndexName();
  $indexContent = $this
    ->getValue($indexName);
  if (!$indexContent) {
    return false;
  }
  $profileList = explode("\n", $indexContent);
  foreach ($profileList as $item) {
    if ($item == '') {
      continue;
    }
    if (false !== ($pos = strpos($item, "\t"))) {
      $this
        ->delete($this
        ->getItemName(substr($item, 0, $pos)));
    }
  }
  return $this
    ->delete($indexName);
}