vendor/codeages/biz-framework/src/Session/Service/Impl/SessionServiceImpl.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Codeages\Biz\Framework\Session\Service\Impl;

use Codeages\Biz\Framework\Service\BaseService;
use Codeages\Biz\Framework\Service\Exception\InvalidArgumentException;
use Codeages\Biz\Framework\Session\Service\SessionService;
use Codeages\Biz\Framework\Util\ArrayToolkit;

class SessionServiceImpl extends BaseService implements SessionService
{
    public function saveSession($session)
    {
        if (!ArrayToolkit::requireds($session, array('sess_id', 'sess_data'))) {
            throw new InvalidArgumentException('args is invalid.');
        }

        $session['sess_deadline'] = time() + $this->getMaxLifeTime();

        return $this->getSessionStorage()->save($session);
    }

    public function deleteSessionBySessId($sessId)
    {
        return $this->getSessionStorage()->delete($sessId);
    }

    public function getSessionBySessId($sessId)
    {
        return $this->getSessionStorage()->get($sessId);
    }

    public function gc()
    {
        return $this->getSessionStorage()->gc(time());
    }

    protected function getMaxLifeTime()
    {
        return $this->biz['session.options']['max_life_time'];
    }

    protected function getSessionStorage()
    {
        return $this->biz['session.storage.'.$this->biz['session.options']['session_storage']];
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。