use Friendica\BaseObject;
use Friendica\Core\Cache;
+use Friendica\Core\Logger;
use Friendica\Core\Session;
use SessionHandlerInterface;
/**
* SessionHandler using Friendica Cache
*
- * @author Hypolite Petovan <mrpetovan@gmail.com>
+ * @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
{
public function read($session_id)
{
- if (!x($session_id)) {
+ if (empty($session_id)) {
return '';
}
Session::$exists = true;
return $data;
}
- logger("no data for session $session_id", LOGGER_TRACE);
+ Logger::log("no data for session $session_id", Logger::TRACE);
return '';
}
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 destroy($id)
{
- Cache::delete('session:' . $id);
- return true;
+ $return = Cache::delete('session:' . $id);
+
+ return $return;
}
public function gc($maxlifetime)