Improve CacheSessionhandler

- Replace !x() by empty()
- Add return values to read() and destroy()
This commit is contained in:
Hypolite Petovan 2018-04-18 23:37:06 -04:00
parent ca4ca51c6a
commit 87f638bdc9
1 changed files with 6 additions and 5 deletions

View File

@ -24,7 +24,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
public function read($session_id) public function read($session_id)
{ {
if (!x($session_id)) { if (empty($session_id)) {
return ''; return '';
} }
@ -58,9 +58,9 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
return true; return true;
} }
Cache::set('session:' . $session_id, $session_data, Session::$expire); $return = Cache::set('session:' . $session_id, $session_data, Session::$expire);
return true; return $return;
} }
public function close() public function close()
@ -70,8 +70,9 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
public function destroy($id) public function destroy($id)
{ {
Cache::delete('session:' . $id); $return = Cache::delete('session:' . $id);
return true;
return $return;
} }
public function gc($maxlifetime) public function gc($maxlifetime)