<?php require dirname(__FILE__) . '/lib/MessagePackRPC/Client.php'; require dirname(__FILE__) . '/msgpack/ListService.php'; $service = new Temperance_ListService('localhost', 17001); $service->add('albums', 12345); $service->add('albums', 567890); $service->add('albums', 'hello world'); $count = $service->count('albums'); var_dump($count); $values = $service->get('albums'); var_dump($values);
<?php require dirname(__FILE__) . '/PhpBuf/lib/PhpBuf.php'; require dirname(__FILE__) . '/proto/ListService.php'; require dirname(__FILE__) . '/proto/QueryService.php'; $ctx = new PhpBuf_RPC_Context(); $ctx->addServer('localhost', 17001); $service = new Temperance_ListService($ctx); echo 'add key: hoge', PHP_EOL; $addParam = new Temperance_List_Request_Add(); $addParam->key = 'hoge'; $addParam->value = 'value-1'; $service->add($addParam); echo 'hoge: value-1', PHP_EOL; $addParam = new Temperance_List_Request_Add(); $addParam->key = 'hoge'; $addParam->value = 'value-2'; $service->add($addParam); echo 'hoge: value-2', PHP_EOL; echo 'add key: foo', PHP_EOL; $addParam = new Temperance_List_Request_Add(); $addParam->key = 'foo'; $addParam->value = 'value-1'; $service->add($addParam); echo 'foo: value-1', PHP_EOL; $addParam = new Temperance_List_Request_Add(); $addParam->key = 'foo'; $addParam->value = 'value-3'; $service->add($addParam); echo 'foo: value-3', PHP_EOL; $service = new Temperance_QueryService($ctx);
<?php require dirname(__FILE__) . '/lib/MessagePackRPC/Client.php'; require dirname(__FILE__) . '/msgpack/ListService.php'; require dirname(__FILE__) . '/msgpack/QueryService.php'; $service = new Temperance_ListService('localhost', 17001); echo 'add key: hoge', PHP_EOL; $service->add('hoge', 'value-1'); $service->add('hoge', 'value-2'); echo 'add key: foo', PHP_EOL; $service->add('foo', 'value-1'); $service->add('foo', 'value-3'); $service = new Temperance_QueryService('localhost', 17001); $result = $service->select('FROM hoge IN DATA(foo)'); var_dump($result); $result = $service->select('FROM hoge NOT DATA(foo)'); var_dump($result);