Skip to content
CatKang edited this page Feb 24, 2018 · 1 revision

Example

<?php

$zp_options = new Zeppelin("127.0.0.1:9801;127.0.0.1:9802", "options_test", $timeout);

$times = 10000000;
while($times--) {
  $num = rand(10, 1000);
  $ret = $zp->Set("key1", $num);
  if ($ret == false) {
    echo "Set Error". PHP_EOL;
    break;
  }
  $val = $zp->Get("key1");
  if ($val == false || $val != $num) {
    echo "Error, num: ". $num. " val: ". $val. PHP_EOL;
    var_dump($val);
    break;
  }
  $ret = $zp->Delete("key1");
  if ($ret == false) {
    echo "Delete Error". PHP_EOL;
    break;
  }

  $val = $zp->Get("key1");
  if ($val != false) {
    echo "Error, expect false, but: ". " val: ". $val. PHP_EOL;
    var_dump($val);
    break;
  }
}

// mget
$times = 5;
while ($times--) {
  $ret = $zp_mget->Set("mget_key_".$times, "mget_value_".$times);
  if ($ret == false) {
    echo "Set Error". PHP_EOL;
    break;
  }
}

$times = 5;
$keys = array();
while ($times--) {
  array_push($keys, "mget_key_".$times);
}
var_dump($keys);
$ret = $zp_mget->Mget($keys);
if ($ret == false) {
  echo "Mget Error". PHP_EOL;
}
var_dump($ret);

Interface


Zeppelin(ip:port;[ip:port ...], table_name, [timeout]);

Description

Initial Zeppelin Client

Parameters

ip: One of Zeppelin Meta Server ip

port: One of Zeppelin Meta Server port

table: table name

timeout: connection timeout

Return Value

Always Success


Set("key", "value");

Description

Set key value into Zeppelin,add if already exist and modify if not

Parameters

key:

value:

Return Value

TRUE if success, otherwise return FALSE


Get("key");

Description

Get value from Zeppelin

Parameters

key:

Return Value

return VALUE if success, return FALSE if not exist


Mget(key[key ...]);

Description

Get the values of all specified keys.

Parameters

keys:

Return Value

return VALUES if success, return FALSE if not exist


Delete("key");

Description

Delete key value from Zeppelin

Parameters

key:

Return Value

TRUE if success, otherwise return FALSE

Clone this wiki locally