public function set($key, $value, $ttl = null, $condition = array())
    {
        $data = array('value' => $value);

        if ($ttl) {
            $data['ttl'] = $ttl;
        }

        try {
            $response = $this->guzzleclient->put($this->buildKeyUri($key), array(
                'query' => $condition,
                'form_params' => $data
            ));
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        }
        $body = json_decode($response->getBody(), true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }
        return $body;
    }
public function set($key, $value, $ttl = null, $condition = array())
    {
        $data = array('value' => $value);

        if ($ttl) {
            $data['ttl'] = $ttl;
        }

        try {
            $response = $this->guzzleclient->put($this->buildKeyUri($key), array(
                'query' => $condition,
                'form_params' => $data
            ));
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        }
        $body = json_decode($response->getBody(), true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }
        return $body;
    }
public function set ( $ key , $ value , $ ttl = null , $ condition = array ( ) ) { $ data = array ( 'value' => $ value ) ; if ( $ ttl ) { $ data [ 'ttl' ] = $ ttl ; } try { $ response = $ this -> guzzleclient -> put ( $ this -> buildKeyUri ( $ key ) , array ( 'query' => $ condition , 'form_params' => $ data ) ) ; } catch ( BadResponseException $ e ) { $ response = $ e -> getResponse ( ) ; } $ body = json_decode ( $ response -> getBody ( ) , true ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new RuntimeException ( 'Unable to parse response body into JSON: ' . json_last_error ( ) ) ; } return $ body ; }
Set the value of a key
@param string $key
@param string $value
@param int $ttl
@param array $condition
@return stdClass
Set the value of a key