Guest User

Untitled

a guest
Feb 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. require "predis/autoload.php";
  3. PredisAutoloader::register();
  4. try {
  5. $redis = new PredisClient();
  6. }
  7. catch (Exception $e) {
  8. die($e->getMessage());
  9. }
  10. // sets message to contian "Hello world"
  11. $redis->set('message', 'Hello world');
  12. ?>
  13.  
  14. <?php
  15. <!-- THE FOLLOWING PART WHICH CREATES A $redis
  16. OBJECT SEEMS TO BE AN OVERDO. SHOULDN'T WE BE
  17. USING THE SAME $redis OBJECT FROM THE ABOVE SNIPPET?-->
  18.  
  19.  
  20. require "predis/autoload.php";
  21. PredisAutoloader::register();
  22. try {
  23. $redis = new PredisClient();
  24. }
  25. catch (Exception $e) {
  26. die($e->getMessage());
  27. }
  28.  
  29. // gets the value of message
  30. $value = $redis->get('message');
  31. ?>
Add Comment
Please, Sign In to add comment