mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
格式化和注释
This commit is contained in:
@@ -1,8 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace think\session\driver;
|
namespace think\session\driver;
|
||||||
|
|
||||||
use think\session\Driver;
|
|
||||||
use think\Config;
|
use think\Config;
|
||||||
|
use think\session\Driver;
|
||||||
|
|
||||||
class Memcache extends Driver
|
class Memcache extends Driver
|
||||||
{
|
{
|
||||||
@@ -22,7 +32,8 @@ class Memcache extends Driver
|
|||||||
* @param string $savePath
|
* @param string $savePath
|
||||||
* @param mixed $sessName
|
* @param mixed $sessName
|
||||||
*/
|
*/
|
||||||
public function open($savePath, $sessName) {
|
public function open($savePath, $sessName)
|
||||||
|
{
|
||||||
// 检测php环境
|
// 检测php环境
|
||||||
if (!extension_loaded('memcache')) {
|
if (!extension_loaded('memcache')) {
|
||||||
throw new Exception('_NOT_SUPPERT_:memcache');
|
throw new Exception('_NOT_SUPPERT_:memcache');
|
||||||
@@ -45,7 +56,8 @@ class Memcache extends Driver
|
|||||||
* 关闭Session
|
* 关闭Session
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function close() {
|
public function close()
|
||||||
|
{
|
||||||
$this->gc(ini_get('session.gc_maxlifetime'));
|
$this->gc(ini_get('session.gc_maxlifetime'));
|
||||||
$this->handler->close();
|
$this->handler->close();
|
||||||
$this->handler = null;
|
$this->handler = null;
|
||||||
@@ -57,8 +69,9 @@ class Memcache extends Driver
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sessID
|
* @param string $sessID
|
||||||
*/
|
*/
|
||||||
public function read($sessID) {
|
public function read($sessID)
|
||||||
return $this->handler->get($this->config['session_name'].$sessID);
|
{
|
||||||
|
return $this->handler->get($this->config['session_name'] . $sessID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,8 +80,9 @@ class Memcache extends Driver
|
|||||||
* @param string $sessID
|
* @param string $sessID
|
||||||
* @param String $sessData
|
* @param String $sessData
|
||||||
*/
|
*/
|
||||||
public function write($sessID, $sessData) {
|
public function write($sessID, $sessData)
|
||||||
return $this->handler->set($this->config['session_name'].$sessID, $sessData, 0, $this->config['expire']);
|
{
|
||||||
|
return $this->handler->set($this->config['session_name'] . $sessID, $sessData, 0, $this->config['expire']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,8 +90,9 @@ class Memcache extends Driver
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sessID
|
* @param string $sessID
|
||||||
*/
|
*/
|
||||||
public function destroy($sessID) {
|
public function destroy($sessID)
|
||||||
return $this->handler->delete($this->config['session_name'].$sessID);
|
{
|
||||||
|
return $this->handler->delete($this->config['session_name'] . $sessID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +100,8 @@ class Memcache extends Driver
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sessMaxLifeTime
|
* @param string $sessMaxLifeTime
|
||||||
*/
|
*/
|
||||||
public function gc($sessMaxLifeTime) {
|
public function gc($sessMaxLifeTime)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace think\session\driver;
|
namespace think\session\driver;
|
||||||
|
|
||||||
use think\session\Driver;
|
|
||||||
use think\Config;
|
use think\Config;
|
||||||
|
use think\session\Driver;
|
||||||
|
|
||||||
class Redis extends Driver
|
class Redis extends Driver
|
||||||
{
|
{
|
||||||
@@ -23,7 +33,8 @@ class Redis extends Driver
|
|||||||
* @param string $savePath
|
* @param string $savePath
|
||||||
* @param mixed $sessName
|
* @param mixed $sessName
|
||||||
*/
|
*/
|
||||||
public function open($savePath, $sessName) {
|
public function open($savePath, $sessName)
|
||||||
|
{
|
||||||
// 检测php环境
|
// 检测php环境
|
||||||
if (!extension_loaded('redis')) {
|
if (!extension_loaded('redis')) {
|
||||||
throw new Exception('_NOT_SUPPERT_:redis');
|
throw new Exception('_NOT_SUPPERT_:redis');
|
||||||
@@ -44,7 +55,8 @@ class Redis extends Driver
|
|||||||
* 关闭Session
|
* 关闭Session
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function close() {
|
public function close()
|
||||||
|
{
|
||||||
$this->gc(ini_get('session.gc_maxlifetime'));
|
$this->gc(ini_get('session.gc_maxlifetime'));
|
||||||
$this->handler->close();
|
$this->handler->close();
|
||||||
$this->handler = null;
|
$this->handler = null;
|
||||||
@@ -56,8 +68,9 @@ class Redis extends Driver
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sessID
|
* @param string $sessID
|
||||||
*/
|
*/
|
||||||
public function read($sessID) {
|
public function read($sessID)
|
||||||
return $this->handler->get($this->config['session_name'].$sessID);
|
{
|
||||||
|
return $this->handler->get($this->config['session_name'] . $sessID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,8 +79,9 @@ class Redis extends Driver
|
|||||||
* @param string $sessID
|
* @param string $sessID
|
||||||
* @param String $sessData
|
* @param String $sessData
|
||||||
*/
|
*/
|
||||||
public function write($sessID, $sessData) {
|
public function write($sessID, $sessData)
|
||||||
return $this->handler->set($this->config['session_name'].$sessID, $sessData, 0, $this->config['expire']);
|
{
|
||||||
|
return $this->handler->set($this->config['session_name'] . $sessID, $sessData, 0, $this->config['expire']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,8 +89,9 @@ class Redis extends Driver
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sessID
|
* @param string $sessID
|
||||||
*/
|
*/
|
||||||
public function destroy($sessID) {
|
public function destroy($sessID)
|
||||||
return $this->handler->delete($this->config['session_name'].$sessID);
|
{
|
||||||
|
return $this->handler->delete($this->config['session_name'] . $sessID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +99,8 @@ class Redis extends Driver
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $sessMaxLifeTime
|
* @param string $sessMaxLifeTime
|
||||||
*/
|
*/
|
||||||
public function gc($sessMaxLifeTime) {
|
public function gc($sessMaxLifeTime)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user