public function set($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::SET);
    } catch (Error $e) {
      return false;
    }
    return $set_results[0] == SetStatusCode::STORED;
  }
public function set($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::SET);
    } catch (Error $e) {
      return false;
    }
    return $set_results[0] == SetStatusCode::STORED;
  }
public function set ( $ 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 :: SET ) ; } catch ( Error $ e ) { return false ; } return $ set_results [ 0 ] == SetStatusCode :: STORED ; }
Sets the value of a key in the cache regardless of whether it is currently
present or not.

@param string $key The key associated with the value that will be replaced
in the cache.

@param mixed $value The new cache value.

@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 replaced the cache, false
otherwise.
Sets the value of a key in the cache regardless of whether it is currently present or not .