You are here

public function MemcachedMock::add in Zircon Profile 8.0

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

Add an item to the server only if such key doesn't exist at the server yet.

Parameters

string $key:

mixed $value:

int $expiration:

Return value

bool

File

vendor/symfony/http-kernel/Tests/Profiler/Mock/MemcachedMock.php, line 66

Class

MemcachedMock
MemcachedMock for simulating Memcached extension in tests.

Namespace

Symfony\Component\HttpKernel\Tests\Profiler\Mock

Code

public function add($key, $value, $expiration = 0) {
  if (!$this->connected) {
    return false;
  }
  if (!isset($this->storage[$key])) {
    $this
      ->storeData($key, $value);
    return true;
  }
  return false;
}