public function add($key, $value, $flag = null, $expire = 0) {
    // Sending of a key of 'null' or an unset value is a failure.
    if (is_null($key)) {
      return false;
    }

    try {
     $set_results = MemcacheUtils::setMultiWithPolicy(array($key => $value),
                                                      $expire,
                                                      SetPolicy::ADD);
    } catch (Error $e) {
      return false;
    }
    return $set_results[0] == SetStatusCode::STORED;
  }
public function add($key, $value, $flag = null, $expire = 0) {
    // Sending of a key of 'null' or an unset value is a failure.
    if (is_null($key)) {
      return false;
    }

    try {
     $set_results = MemcacheUtils::setMultiWithPolicy(array($key => $value),
                                                      $expire,
                                                      SetPolicy::ADD);
    } catch (Error $e) {
      return false;
    }
    return $set_results[0] == SetStatusCode::STORED;
  }
public function add ( $ key , $ value , $ flag = null , $ expire = 0 ) { // Sending of a key of 'null' or an unset value is a failure. if ( is_null ( $ key ) ) { return false ; } try { $ set_results = MemcacheUtils :: setMultiWithPolicy ( array ( $ key => $ value ) , $ expire , SetPolicy :: ADD ) ; } catch ( Error $ e ) { return false ; } return $ set_results [ 0 ] == SetStatusCode :: STORED ; }
Adds a new item to the cache. Will fail if the key is already present in
the cache.

@param string $key The key associated with the value added to the cache.

@param mixed $value The value to add to the cache.

@param int $flag This parameter is present only for compatibility and is
ignored.

@param int $expire The delay before the item is removed from the cache. If
$expire <= 2592000 then it is interpreted as the number
of seconds from the time of the call to wait before
removing the item from the cache. If $expire > 2592000
then it is interpreted as the absolute Unix epoch time
when the value will expire.

@return bool true if the item was successfully added to the cache, false
otherwise.
Adds a new item to the cache . Will fail if the key is already present in the cache .