original_string: public function cas($cas_token, $key, $value, $expiration = 0) {
      $key = $this->getPrefixKey($key);
      $request = new MemcacheSetRequest();
      $response = new MemcacheSetResponse();
  
      $memcache_flag = 0;
      $serialized_value = MemcacheUtils::serializeValue($value, $memcache_flag);
  
      $item = $request->addItem();
      $item->setKey($key);
      $item->setValue($serialized_value);
      $item->setFlags($memcache_flag);
      $item->setSetPolicy(SetPolicy::CAS);
      $item->setCasId($cas_token);
      $item->setExpirationTime($expiration);
  
      try {
        ApiProxy::makeSyncCall('memcache', 'Set', $request, $response);
      } catch (Error $e) {
        $this->result_code = self::RES_FAILURE;
        return false;
      }
  
      switch ($response->getSetStatusList()[0]) {
        case SetStatusCode::STORED:
          $this->result_code = self::RES_SUCCESS;
          return true;
        case SetStatusCode::NOT_STORED:
          $this->result_code = self::RES_NOTSTORED;
          return false;
        case SetStatusCode::EXISTS:
          $this->result_code = self::RES_DATA_EXISTS;
          return false;
        default:
          $this->result_code = self::RES_FAILURE;
          return false;
      }
    }
code: public function cas($cas_token, $key, $value, $expiration = 0) {
      $key = $this->getPrefixKey($key);
      $request = new MemcacheSetRequest();
      $response = new MemcacheSetResponse();
  
      $memcache_flag = 0;
      $serialized_value = MemcacheUtils::serializeValue($value, $memcache_flag);
  
      $item = $request->addItem();
      $item->setKey($key);
      $item->setValue($serialized_value);
      $item->setFlags($memcache_flag);
      $item->setSetPolicy(SetPolicy::CAS);
      $item->setCasId($cas_token);
      $item->setExpirationTime($expiration);
  
      try {
        ApiProxy::makeSyncCall('memcache', 'Set', $request, $response);
      } catch (Error $e) {
        $this->result_code = self::RES_FAILURE;
        return false;
      }
  
      switch ($response->getSetStatusList()[0]) {
        case SetStatusCode::STORED:
          $this->result_code = self::RES_SUCCESS;
          return true;
        case SetStatusCode::NOT_STORED:
          $this->result_code = self::RES_NOTSTORED;
          return false;
        case SetStatusCode::EXISTS:
          $this->result_code = self::RES_DATA_EXISTS;
          return false;
        default:
          $this->result_code = self::RES_FAILURE;
          return false;
      }
    }
code_tokens: public function cas ( $ cas_token , $ key , $ value , $ expiration = 0 ) { $ key = $ this -> getPrefixKey ( $ key ) ; $ request = new MemcacheSetRequest ( ) ; $ response = new MemcacheSetResponse ( ) ; $ memcache_flag = 0 ; $ serialized_value = MemcacheUtils :: serializeValue ( $ value , $ memcache_flag ) ; $ item = $ request -> addItem ( ) ; $ item -> setKey ( $ key ) ; $ item -> setValue ( $ serialized_value ) ; $ item -> setFlags ( $ memcache_flag ) ; $ item -> setSetPolicy ( SetPolicy :: CAS ) ; $ item -> setCasId ( $ cas_token ) ; $ item -> setExpirationTime ( $ expiration ) ; try { ApiProxy :: makeSyncCall ( 'memcache' , 'Set' , $ request , $ response ) ; } catch ( Error $ e ) { $ this -> result_code = self :: RES_FAILURE ; return false ; } switch ( $ response -> getSetStatusList ( ) [ 0 ] ) { case SetStatusCode :: STORED : $ this -> result_code = self :: RES_SUCCESS ; return true ; case SetStatusCode :: NOT_STORED : $ this -> result_code = self :: RES_NOTSTORED ; return false ; case SetStatusCode :: EXISTS : $ this -> result_code = self :: RES_DATA_EXISTS ; return false ; default : $ this -> result_code = self :: RES_FAILURE ; return false ; } }
docstring: Performs a set and check operation, so that the item will be stored only
  if no other client has updated it since it was last fetched by this
  client.
  
  @param mixed $cas_token Unique memcached assigned value.
  @param string $key The key under which to store the value.
  @param mixed $value The value to store.
  @param int $expiration The expiration time, defaults to 0.
  
  @return bool True on success, or false on failure.
docstring_tokens: Performs a set and check operation so that the item will be stored only if no other client has updated it since it was last fetched by this client .