setRoot() public méthode

$client->setRoot('/linkorb'); $client->set('key1, 'value1'); the new key is /linkorb/key1
public setRoot ( string $root ) : Client
$root string
Résultat Client
Exemple #1
0
 protected function tearDown()
 {
     $this->client->setRoot('/');
     $this->client->rmdir($this->dirname, true);
 }
Exemple #2
0
 * The use case for this is a long running initial product download or sync
 *
 * We create a new lock with a 3 second time out
 *
 * We then try to immediately create a new lock, which should fail
 *
 * We then refresh the original lock, increasing the timeout by another 3 seconds
 *
 * We then try to create a new lock, which should fail
 */
$pid = getmypid();
$hostname = gethostname();
$jobPid = $hostname . ':' . $pid;
echo "PID: {$jobPid}\n";
$client = new Client();
$client->setRoot("{$account_id}");
echo "Setting initial lock, timeout of 3 seconds\n";
$result1 = $client->set("/{$connector_id}", $jobPid, 3);
print_r($result1);
echo "\n";
echo "Printing directory tree\n";
print_r($client->listDir('/', true));
echo "\n";
echo "Attemping to set value\n";
$result2 = $client->set("/{$connector_id}", $jobPid . "-next", 3, ['prevExist' => 'false']);
print_r($result2);
echo "\n";
echo "Refreshing lock, timeout of 3 seconds\n";
$result1 = $client->set("/{$connector_id}", $jobPid, 3, ['prevValue' => $jobPid]);
print_r($result1);
echo "\n";