コード例 #1
1
ファイル: bootstrap.php プロジェクト: iliubang/Linger-v2.0
 /**
  * @param $app \Linger\Core\App
  */
 public function initSession($app)
 {
     $session = Linger::C('SESSION');
     Linger::getSessionHandler($session)->begin();
     session_cache_limiter('private, must-revalidate');
     //支持页面回跳
     session_start();
 }
コード例 #2
0
ファイル: App.php プロジェクト: iliubang/Linger-v2.0
 /**
  * @return Linger\core\app
  */
 public function bootstrap()
 {
     static::$bootstrap_func = get_class_methods(Linger::C('BOOTSTRAP_NAME'));
     $bootstrap = Linger::C('BOOTSTRAP_NAME');
     $bootstrap = new $bootstrap();
     foreach (static::$bootstrap_func as $func) {
         if (substr($func, 0, 4) === 'init') {
             call_user_func(array($bootstrap, $func), $this);
         }
     }
     return $this;
 }
コード例 #3
0
ファイル: MySql.php プロジェクト: iliubang/Linger-v2.0
 /**
  * @param string $savePath
  * @param string $sessionName
  *
  * @return bool
  */
 public function open($savePath, $sessionName)
 {
     if (null !== $this->_options['handler']) {
         return true;
     }
     $dbHandler = Linger::D($this->_options['DRIVER'] . ':' . $this->_options['TABLE']);
     if (!$dbHandler) {
         return false;
     }
     $this->_options['handler'] = $dbHandler;
     $this->gc(null);
     return true;
 }
コード例 #4
0
ファイル: Redis.php プロジェクト: iliubang/Linger-v2.0
 /**
  * @param string $savePath
  * @param string $sessionName
  *
  * @return bool
  */
 public function open($savePath, $sessionName)
 {
     if (!is_resource($this->_options['handler'])) {
         //连接redis
         $redisHandle = new \Redis();
         $redisHandle->connect(Linger::C($this->_options['DRIVER'])['HOST'], Linger::C($this->_options['DRIVER'])['PORT']);
         if (!$redisHandle) {
             return false;
         }
         $this->_options['handler'] = $redisHandle;
         $this->gc(null);
     }
     return true;
 }
コード例 #5
0
ファイル: UtilMonitor.php プロジェクト: iliubang/Linger-v2.0
 public static function mark($key, $num = 1)
 {
     self::conf();
     $keys = self::keys($key);
     if ($keys === false) {
         return false;
     }
     $redisConf = Linger::C('redis.monitor');
     $redis = new Redis();
     try {
         $redis->connect($redisConf['host'], $redisConf['port'], 0.5);
     } catch (\Exception $e) {
     }
     $now = time();
     if ($num > 0) {
         $redis->incrBy($keys['count'], $num);
     } else {
         $redis->incr($keys['count']);
     }
     $redis->set($keys['time'], $now);
 }