mirror of
https://github.com/predis/predis.git
synced 2026-09-12 03:17:22 +00:00
Minor code and formatting changes for the example files.
This commit is contained in:
@@ -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']
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
*/
|
||||
?>
|
||||
|
||||
@@ -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";
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
)
|
||||
*/
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
)
|
||||
*/
|
||||
?>
|
||||
|
||||
@@ -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,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',
|
||||
),
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -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]
|
||||
)
|
||||
*/
|
||||
?>
|
||||
|
||||
@@ -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"
|
||||
*/
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user