Project

General

Profile

1
<?php
2

    
3
/*
4
 * This file is part of the Predis package.
5
 *
6
 * (c) Daniele Alessandri <suppakilla@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

    
12
require 'SharedConfigurations.php';
13

    
14
// redis can set keys and their relative values in one go
15
// using MSET, then the same values can be retrieved with
16
// a single command using MGET.
17

    
18
$mkv = array(
19
    'usr:0001' => 'First user',
20
    'usr:0002' => 'Second user',
21
    'usr:0003' => 'Third user'
22
);
23

    
24
$client = new Predis\Client($single_server);
25

    
26
$client->mset($mkv);
27
$retval = $client->mget(array_keys($mkv));
28

    
29
print_r($retval);
30

    
31
/* OUTPUT:
32
Array
33
(
34
    [0] => First user
35
    [1] => Second user
36
    [2] => Third user
37
)
38
*/
(8-8/17)