Przeglądaj źródła

Minor code and formatting changes for the example files.

Daniele Alessandri 14 lat temu
rodzic
commit
b5a1ba9795

+ 2 - 2
examples/CustomDistributionStrategy.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 // Developers can customize the distribution strategy used by the client
 // to distribute keys among a cluster of servers simply by creating a class
@@ -57,4 +58,3 @@ $server2 = $redis->getClientFor('second')->info();
 printf("Server '%s' has %d keys while server '%s' has %d keys.\n",
     'first', $server1['db15']['keys'], 'second', $server2['db15']['keys']
 );
-?>

+ 2 - 2
examples/KeyPrefixes.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 // Predis ships with a KeyPrefixPreprocessor class that is used to transparently
 // prefix each key before sending commands to Redis, even for complex commands
@@ -28,4 +29,3 @@ array(2) {
   [1]=> string(7) "nrk:lol"
 }
 */
-?>

+ 2 - 2
examples/MultiExecTransactionsWithCAS.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 /*
 This is an implementation of an atomic client-side ZPOP using the support for
@@ -38,4 +39,3 @@ function zpop($client, $zsetKey) {
 $redis = new Predis\Client($single_server, 'dev');
 $zpopped = zpop($redis, 'zset');
 echo isset($zpopped) ? "ZPOPed $zpopped" : "Nothing to ZPOP!", "\n";
-?>

+ 2 - 2
examples/MultipleSetAndGet.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 // redis can set keys and their relative values in one go
 // using MSET, then the same values can be retrieved with
@@ -26,4 +27,3 @@ Array
     [2] => Third user
 )
 */
-?>

+ 2 - 2
examples/PipelineContext.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require '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.
@@ -35,4 +36,3 @@ Array
 
 )
 */
-?>

+ 2 - 2
examples/PubSubContext.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 // Redis 2.0 features new commands that allow clients to subscribe for
 // events published on certain channels (PUBSUB).
@@ -48,4 +49,3 @@ unset($pubsub);
 // Say goodbye :-)
 $info = $redis->info();
 print_r("Goodbye from Redis v{$info['redis_version']}!\n");
-?>

+ 1 - 1
examples/SharedConfigurations.php

@@ -1,4 +1,5 @@
 <?php
+
 spl_autoload_register(function($class) {
     $file = __DIR__.'/../lib/'.strtr($class, '\\', '/').'.php';
     if (file_exists($file)) {
@@ -27,4 +28,3 @@ $multiple_servers = array(
        'alias'    => 'second',
     ),
 );
-?>

+ 2 - 2
examples/SimpleDebuggableConnection.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 use Predis\ConnectionParameters;
 use Predis\Commands\ICommand;
@@ -66,4 +67,3 @@ Array
     [7] => INFO <- 127.0.0.1:6379 [0.0025s]
 )
 */
-?>

+ 4 - 4
examples/SimpleSetAndGet.php

@@ -1,5 +1,6 @@
 <?php
-require_once 'SharedConfigurations.php';
+
+require 'SharedConfigurations.php';
 
 // simple set and get scenario
 
@@ -8,9 +9,8 @@ $redis = new Predis\Client($single_server);
 $redis->set('library', 'predis');
 $retval = $redis->get('library');
 
-print_r($retval);
+var_dump($retval);
 
 /* OUTPUT
-predis
+string(6) "predis"
 */
-?>