提交 74d18b23 编写于 作者: lzc828's avatar lzc828

redis session

上级 4c8a577b
......@@ -2,7 +2,7 @@
namespace One\Cache;
use One\Facades\Redis;
use One\Facades\Redis as FacadesRedis;
class SessionHandler implements \SessionHandlerInterface
{
......@@ -27,12 +27,13 @@ class SessionHandler implements \SessionHandlerInterface
public function destroy($session_id)
{
return Redis::del($this->prefix . $session_id) ? true : false;
return FacadesRedis::del($this->prefix . $session_id) ? true : false;
}
public function gc($maxlifetime)
{
return true;
return 0;
}
public function open($save_path, $name)
......@@ -42,12 +43,12 @@ class SessionHandler implements \SessionHandlerInterface
public function read($session_id)
{
return (string)@Redis::get($this->prefix . $session_id);
return (string)@FacadesRedis::get($this->prefix . $session_id);
}
public function write($session_id, $session_data)
{
return Redis::setex($this->prefix . $session_id, $this->expire_time, $session_data);
return FacadesRedis::set($this->prefix . $session_id, $session_data, $this->expire_time);
}
......
......@@ -24,7 +24,7 @@ class Session
}
session_start();
setcookie(session_name(), session_id(), time() + $time, '/');
$this->data = $_SESSION;
$this->data = &$_SESSION;
}
public function getId()
......
......@@ -10,6 +10,6 @@ if (!defined('_DEBUG_')) {
define('_DEBUG_', false);
}
define('_ONE_V_', '1.6.12');
define('_ONE_V_', '1.6.13');
require __DIR__ . '/helper.php';
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册