Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require "predis/autoload.php";
- PredisAutoloader::register();
- try {
- $redis = new PredisClient();
- }
- catch (Exception $e) {
- die($e->getMessage());
- }
- // sets message to contian "Hello world"
- $redis->set('message', 'Hello world');
- ?>
- <?php
- <!-- THE FOLLOWING PART WHICH CREATES A $redis
- OBJECT SEEMS TO BE AN OVERDO. SHOULDN'T WE BE
- USING THE SAME $redis OBJECT FROM THE ABOVE SNIPPET?-->
- require "predis/autoload.php";
- PredisAutoloader::register();
- try {
- $redis = new PredisClient();
- }
- catch (Exception $e) {
- die($e->getMessage());
- }
- // gets the value of message
- $value = $redis->get('message');
- ?>
Add Comment
Please, Sign In to add comment