Explorar o código

Updated the examples to match the PHP 5.2 version.

Daniele Alessandri %!s(int64=15) %!d(string=hai) anos
pai
achega
d05a62e82c
Modificáronse 3 ficheiros con 12 adicións e 12 borrados
  1. 10 10
      examples/CommandPipeline.php
  2. 1 1
      examples/MultipleSetAndGet.php
  3. 1 1
      examples/SimpleSetAndGet.php

+ 10 - 10
examples/CommandPipeline.php

@@ -4,17 +4,17 @@ 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 = Predis\Client::create($configurations);
+$redis = Predis_Client::create($configurations);
 
-$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');
-});
+$pipe = $redis->pipeline();
+$pipe->ping();
+$pipe->flushdb();
+$pipe->incrby('counter', 10);
+$pipe->incrby('counter', 30);
+$pipe->exists('counter');
+$pipe->get('counter');
+$pipe->mget('does_not_exist', 'counter');
+$replies = $pipe->execute();
 
 print_r($replies);
 

+ 1 - 1
examples/MultipleSetAndGet.php

@@ -11,7 +11,7 @@ $mkv = array(
     'usr:0003' => 'Third user' 
 );
 
-$redis = Predis\Client::create($configurations);
+$redis = Predis_Client::create($configurations);
 
 $redis->mset($mkv);
 $retval = $redis->mget(array_keys($mkv));

+ 1 - 1
examples/SimpleSetAndGet.php

@@ -3,7 +3,7 @@ require_once 'SharedConfigurations.php';
 
 // simple set and get scenario
 
-$redis = Predis\Client::create($configurations);
+$redis = Predis_Client::create($configurations);
 
 $redis->set('library', 'predis');
 $retval = $redis->get('library');