123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- require_once 'SharedConfigurations.php';
- // when you have a whole set of consecutive commands to send to
- // a redis server, you can use a pipeline to improve performances.
- $redis = new Predis\Client(REDIS_HOST, REDIS_PORT);
- $redis->select(REDIS_DB);
- $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);
- /* OUTPUT:
- Array
- (
- [0] => 1
- [1] => 1
- [2] => 10
- [3] => 40
- [4] => 1
- [5] => 40
- [6] => Array
- (
- [0] =>
- [1] => 40
- )
- )
- */
- ?>
|