LinkORB\Component\Etcd\Client::mk PHP 메소드

mk() 공개 메소드

make a new key with a given value
public mk ( string $key, string $value, integer $ttl ) : array
$key string
$value string
$ttl integer
리턴 array $body
    public function mk($key, $value, $ttl = 0)
    {
        $body = $request = $this->set($key, $value, $ttl, array('prevExist' => 'false'));
        if (isset($body['errorCode'])) {
            throw new KeyExistsException($body['message'], $body['errorCode']);
        }
        return $body;
    }

Usage Example

예제 #1
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $server = $input->getArgument('server');
     $key = $input->getArgument('key');
     $value = $input->getArgument('value');
     $output->writeln("<info>Create `{$key}` with `{$value}`</info>");
     $client = new EtcdClient($server);
     $data = $client->mk($key, $value);
     $json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     echo $json;
 }
All Usage Examples Of LinkORB\Component\Etcd\Client::mk