public function MemcachedMock::add

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

Parameters

string $key:

mixed $value:

integer $expiration:

Return value

boolean

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php, line 72

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;
}