session handeling in redis with php

169 views Asked by At

I want to do session handling with redis session with php i am doing this:

 <?php
  require 'Predis/Autoload.php';
   Predis\Autoloader::register();
   try {
 $redis = new Predis\Client();
// This connection is for a remote server
   $redis = new Predis\Client(array(
      "scheme" => "tcp",
      "host" => "xxxxxx",
      "port" => xxxx,
      "password" => "xxxxxxx",
      "db" => "brlp_apps",
        ));
 $redis->set('message', 'Hello world');

  $value = $redis->get('message');

 print($value); 
  echo ($redis->exists('message')) ? "Oui" : "please populate the     message key";
 }
 catch (Exception $e) {
  die($e->getMessage());
 }
 ?>

I am following this tutorial. I am able to set up remote connection with redis database but how can I use it to handle sessions. Any suggestions?

0

There are 0 answers