Skip to content

Commit

Permalink
Add exists() and dirExists() example
Browse files Browse the repository at this point in the history
  • Loading branch information
ilijastuden committed Dec 17, 2015
1 parent ff56d13 commit 1caa43d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ use use ActiveCollab\Etcd\Client as EtcdClient;
$client = new EtcdClient('http://127.0.0.1:4001');

// Get, set, update, remove key
$client->set('/key/name', 'value');
if (!$client->exists('/key/name')) {
$client->set('/key/name', 'value');
}
$client->set('/key/name', 'value', 10); // Set TTL
print $client->get('/key/name');

Expand All @@ -41,7 +43,9 @@ $client->update('/key/name', 'new value');
$client->remove('/key/name');

// Working with dirs
$client->createDir('/dir/path');
if (!$client->dirExists('/dir/path')) {
$client->createDir('/dir/path');
}
$client->updateDir('/dir/path', 10); // Set TTL
$client->removeDir('/dir/path');

Expand Down

0 comments on commit 1caa43d

Please sign in to comment.