LinkORB\Component\Etcd\Client::get PHP Method

get() public method

Retrieve the value of a key
public get ( string $key, array $flags = null ) : string
$key string
$flags array the extra query params
return string the value of the key.
    public function get($key, array $flags = null)
    {
        try {
            $node = $this->getNode($key, $flags);
            return $node['value'];
        } catch (KeyNotFoundException $ex) {
            throw $ex;
        }
    }

Usage Example

示例#1
0
 /**
  * @covers LinkORB\Component\Etcd\Client::update
  * @expectedException \LinkORB\Component\Etcd\Exception\KeyNotFoundException
  */
 public function testUpdate()
 {
     $key = '/testupdate_key';
     $value1 = 'value1';
     $value2 = 'value2';
     $this->client->update($key, $value1);
     $this->client->set($key, $value2);
     $value = $this->client->get($key);
     $this->assertEquals('value2', $value);
 }
All Usage Examples Of LinkORB\Component\Etcd\Client::get