Rediska

Follow me on twitter…

Pipelining

If you want to quickly execute several commands in one go, use pipeline() method:

<?php

require_once 'Rediska.php';
$rediska = new Rediska();

$result = $rediska->pipeline()
                  ->set('a', 1)
                  ->increment('a', 10)
                  ->rename('a', 'b')
                  ->get('a')
                  ->execute(); // Send commands and return responses

// Increment several counters for example
$counters = array('counter1', 'counter2', 'counterN');
$pipeline = $rediska->pipeline();
foreach($counters as $counter) {
    $pipeline->increment($counter);
}
$result = $pipeline->execute(); // Send commands and return responses

?>

Comments