echo colorize("Adding characters with PK=1-4 ≻", 'black', true);
$start = __LINE__;
$characters = array(1 => "Philip J. Fry", 2 => "Tarunga Leela", 3 => "Bender Bending Rodriguez", 4 => "Professor Hubert J. Farnsworth");
foreach ($characters as $id => $character) {
    $new_key = "key{$id}";
    var_dump($new_key);
    ${$new_key} = $db->initKey("test", "characters", $id);
    $db->put(${$new_key}, array("id" => $id, "name" => $character));
}
if (isset($args['a']) || isset($args['annotate'])) {
    display_code(__FILE__, $start, __LINE__);
}
echo colorize("Getting the record metadata of keys 1-4 ≻", 'black', true);
$start = __LINE__;
$keys = array($key1, $key2, $key3, $key4);
$res = $db->existsMany($keys, $metadata);
if ($res == AEROSPIKE::OK) {
    echo success();
    var_dump($metadata);
} else {
    echo standard_fail($db);
}
if (isset($args['a']) || isset($args['annotate'])) {
    display_code(__FILE__, $start, __LINE__);
}
echo colorize("Getting 'name' bins of the inserted records ≻", 'black', true);
$start = __LINE__;
$res = $db->getMany($keys, $records, array('name'));
if ($res == AEROSPIKE::OK) {
    echo success();
    var_dump($records);
Exemplo n.º 2
0
        var_dump($records);
        if ($status != Aerospike::OK) {
            echo "\ngetMany operation failed!";
        }
        $db->close();
    } else {
        echo "Aerospike DB connection is not established";
    }
});
$app->get('/existsmany', function () use($db) {
    if ($db->isConnected()) {
        $keys = [];
        for ($i = 0; $i < 100; $i++) {
            $keys[] = $db->initKey("test", "demo", "key" . $i);
        }
        $status = $db->existsMany($keys, $meta);
        var_dump($meta);
        if ($status != Aerospike::OK) {
            echo "\nexistsMany operation failed!";
        }
        $db->close();
    } else {
        echo "Aerospike DB connection is not established";
    }
});
$app->get('/scan', function () use($db) {
    if ($db->isConnected()) {
        $status = $db->scan("test", "demo", function ($record) {
            var_dump($record);
            return true;
        }, array(Aerospike::OPT_SCAN_CONCURRENTLY => true));