update examples

This commit is contained in:
Till Krüss
2023-01-17 14:43:40 -08:00
committed by Till Krüss
parent f4bd6d44b1
commit 3c8a811ca3
6 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ class EventsListener implements Countable
}
// Attach our callable class to the dispatcher.
$dispatcher->attachCallback('events', ($events = new EventsListener()));
$dispatcher->attachCallback('events', $events = new EventsListener());
// Attach a function to control the dispatcher loop termination with a message.
$dispatcher->attachCallback('control', function ($payload, $dispatcher) {
+6 -3
View File
@@ -18,7 +18,8 @@ $client = new Predis\Client($single_server);
$client->set('library', 'predis');
$response = $client->get('library');
var_export($response); echo PHP_EOL;
var_export($response);
echo PHP_EOL;
/* OUTPUT: 'predis' */
// Redis has the MSET and MGET commands to set or get multiple keys in one go,
@@ -33,7 +34,8 @@ $mkv = [
$client->mset($mkv);
$response = $client->mget(array_keys($mkv));
var_export($response); echo PHP_EOL;
var_export($response);
echo PHP_EOL;
/* OUTPUT:
array (
0 => '1st user',
@@ -49,7 +51,8 @@ $response = $client->executeRaw([
'MGET', 'uid:0001', 'uid:0002', 'uid:0003',
]);
var_export($response); echo PHP_EOL;
var_export($response);
echo PHP_EOL;
/* OUTPUT:
array (
0 => '1st user',
+1 -1
View File
@@ -30,7 +30,7 @@ use Predis\Replication\ReplicationStrategy;
class HashMultipleGetAll extends ScriptCommand
{
const BODY = <<<LUA
public const BODY = <<<LUA
local hashes = {}
for _, key in pairs(KEYS) do
table.insert(hashes, key)
+1 -1
View File
@@ -26,7 +26,7 @@ require __DIR__ . '/shared.php';
//
if (!interface_exists('SessionHandlerInterface')) {
die('ATTENTION: the session handler implemented by Predis requires PHP >= 5.4.0 ' .
exit('ATTENTION: the session handler implemented by Predis requires PHP >= 5.4.0 ' .
"or a polyfill for SessionHandlerInterface provided by an external package.\n");
}
+1 -1
View File
@@ -11,7 +11,7 @@
*/
if (PHP_SAPI !== 'cli') {
die('Example scripts are meant to be executed locally via CLI.');
exit('Example scripts are meant to be executed locally via CLI.');
}
require __DIR__ . '/../autoload.php';