Example #1
0
<?php

$tt = new TokyoTyrant("localhost");
$tt->put("key", "value");
echo $tt->get("key");
Example #2
0
$sport = $argv[3];
if (!is_numeric($mport)) {
    echo "require mport\n";
    usage();
}
if (!is_numeric($sport)) {
    $sport = $mport;
}
if (!$mhost) {
    $mhost = 'localhost';
}
if (!$shost) {
    $shost = 'localhost';
}
$mt = new TokyoTyrant($mhost, $mport);
$st = new TokyoTyrant($shost, $sport);
$mit = $mt->getIterator();
$onum = 10000;
$total = 0;
$utotal = 0;
$i = 0;
record_time($stime);
foreach ($mit as $k => $v) {
    ++$i;
    $mdatas[$k] = $v;
    $keys[] = $k;
    if ($i >= $onum) {
        $total += $i;
        $i = 0;
        $udatas = array();
        $sdatas = $st->get($keys);