-
-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
130 changed files
with
2,037 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Predis package. | ||
* | ||
* (c) 2009-2020 Daniele Alessandri | ||
* (c) 2021-2023 Till Krüss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
require __DIR__ . '/shared.php'; | ||
|
||
// Enable igbinary serializer as well as LZ4 compression | ||
$options = [ | ||
'serializer' => 'igbinary', | ||
'compression' => 'lz4', | ||
]; | ||
|
||
$client = new Predis\Client($single_server + $options, [ | ||
'connections' => 'relay', | ||
]); | ||
|
||
$quote = (object) [ | ||
'author' => 'Jean-Luc Picard', | ||
'text' => 'I look forward to your report Mr. Broccoli.', | ||
]; | ||
|
||
// Serialize object and apply LZ4 compression, then write key to Redis | ||
$client->set('quote', $client->pack($quote)); | ||
|
||
// NOTE: In Predis v3.x serialization and compression will happen | ||
// automatically without the need to call `pack()` and `unpack()` | ||
|
||
// Retrieve raw binary value from Redis | ||
$raw = $client->get('quote'); | ||
|
||
// Decompress and unserialize binary value | ||
$data = $client->unpack($raw); | ||
|
||
var_dump($quote == $data); // true | ||
|
||
var_dump($data); | ||
|
||
/* | ||
object(stdClass)#11 (2) { | ||
["author"]=>string(15) "Jean-Luc Picard" | ||
["text"]=>string(43) "I look forward to your report Mr. Broccoli." | ||
} | ||
*/ |
Oops, something went wrong.