nrk (owner)

Revisions

gist: 226073 Download_button fork
public
Description:
Pipelining commands in redis-php (or whatever the name will be)
Public Clone URL: git://gist.github.com/226073.git
Embed All Files: show embed
dumped_result.txt #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Array
(
    [0] => 1
    [1] => 1
    [2] => 10
    [3] => 40
    [4] => 1
    [5] => 40
    [6] => Array
        (
            [0] =>
            [1] => 40
        )
 
)
 
pipelining.php #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
require_once '../lib/Redis.php';
// PHP 5.3
 
$redis = new Redis\Client("127.0.0.1", 6379);
$redis->connect();
 
$replies = $redis->pipeline(function($pipe) {
    $pipe->ping();
    $pipe->flushdb();
    $pipe->incrby('counter', 10);
    $pipe->incrby('counter', 30);
    $pipe->exists('counter');
    $pipe->get('counter');
    $pipe->mget('does_not_exist', 'counter');
});
 
print_r($replies);
?>