You are here

public function RedisMock::delete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/Profiler/Mock/RedisMock.php \Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock::delete()

Remove specified keys.

Parameters

string|array $key:

Return value

int

File

vendor/symfony/http-kernel/Tests/Profiler/Mock/RedisMock.php, line 164

Class

RedisMock
RedisMock for simulating Redis extension in tests.

Namespace

Symfony\Component\HttpKernel\Tests\Profiler\Mock

Code

public function delete($key) {
  if (!$this->connected) {
    return false;
  }
  if (is_array($key)) {
    $result = 0;
    foreach ($key as $k) {
      if (isset($this->storage[$k])) {
        unset($this->storage[$k]);
        ++$result;
      }
    }
    return $result;
  }
  if (isset($this->storage[$key])) {
    unset($this->storage[$key]);
    return 1;
  }
  return 0;
}