<?php
class MySessionHandler implements SessionHandlerInterface
{
    private $redis;
    private $sessionsavepath;
    private $sessionname;
    public function __construct()
    {
        $this->redis = new Redis();
        $this->redis->connect('127.0.0.1',6379);
    }
    public function close()
    {
        return true;
    }
    public function destroy($session_id)
    {
        if($this->redis->delete($session_id)){
            return true;
        }
        return false;
    }
    public function gc($maxlifetime)
    {
        return true;
    }
    public function open($sessionsavepath, $name)
    {
        return true;
    }
    public function read($session_id)
    {
        if($value = $this->redis->get($session_id)){
            return $value;
        }else{
            return false;
        }
    }
    public function write($session_id, $session_data)
    {
        if($this->redis->set($session_id,$session_data,60)){
            return true;
        }else{
            return false;
        }
    }

}

$handler = new MySessionHandler();
session_set_save_handler($handler, true);
session_start();

//$_SESSION['sess_name'] = 'xd';
var_dump($_SESSION);