|
@@ -72,14 +72,17 @@ class session
|
|
|
}
|
|
|
|
|
|
public function onOpen() {
|
|
|
+ Log::record("onOpen",Log::DEBUG);
|
|
|
return true;
|
|
|
}
|
|
|
public function onRead($sid)
|
|
|
{
|
|
|
+ Log::record("onRead sid={$sid}",Log::DEBUG);
|
|
|
$ret = $this->redis->hGet(self::prefix,$sid);
|
|
|
if(empty($ret))
|
|
|
{
|
|
|
if(empty($_COOKIE[self::session_name]) || $_COOKIE[self::session_name] != $sid) {
|
|
|
+ Log::record("onRead fcgi_setcookie reset cookie",Log::DEBUG);
|
|
|
fcgi_setcookie("PHPSESSID","{$sid}",time() + self::sid_expire);
|
|
|
}
|
|
|
return '';
|
|
@@ -89,18 +92,26 @@ class session
|
|
|
}
|
|
|
|
|
|
public function onClose() {
|
|
|
+ Log::record("onClose",Log::DEBUG);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public function onWrite($sid, $data) {
|
|
|
- return $this->redis->hSet(self::prefix,$sid,$data);
|
|
|
+ Log::record("onWrite sid={$sid}",Log::DEBUG);
|
|
|
+ $ret = $this->redis->hSet(self::prefix,$sid,$data);
|
|
|
+ if($ret != false) {
|
|
|
+ $this->redis->expire();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function onDestroy($sid) {
|
|
|
+ Log::record("onDestroy sid={$sid}",Log::DEBUG);
|
|
|
return dcache($sid,self::prefix);
|
|
|
}
|
|
|
|
|
|
public function onGc($expire) {
|
|
|
+ Log::record("onGc expire={$expire}",Log::DEBUG);
|
|
|
return true;
|
|
|
}
|
|
|
|