1、bug的修复
2、内核更新
This commit is contained in:
6
core/library/think/cache/driver/File.php
vendored
6
core/library/think/cache/driver/File.php
vendored
@@ -38,8 +38,8 @@ class File
|
||||
if (!empty($options)) {
|
||||
$this->options = array_merge($this->options, $options);
|
||||
}
|
||||
if (substr($this->options['path'], -1) != '/') {
|
||||
$this->options['path'] .= '/';
|
||||
if (substr($this->options['path'], -1) != DS) {
|
||||
$this->options['path'] .= DS;
|
||||
}
|
||||
$this->init();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class File
|
||||
$dir = '';
|
||||
$len = $this->options['path_level'];
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$dir .= $name{$i} . '/';
|
||||
$dir .= $name{$i} . DS;
|
||||
}
|
||||
if (!is_dir($this->options['path'] . $dir)) {
|
||||
mkdir($this->options['path'] . $dir, 0755, true);
|
||||
|
||||
4
core/library/think/cache/driver/Lite.php
vendored
4
core/library/think/cache/driver/Lite.php
vendored
@@ -36,8 +36,8 @@ class Lite
|
||||
if (!empty($options)) {
|
||||
$this->options = array_merge($this->options, $options);
|
||||
}
|
||||
if (substr($this->options['path'], -1) != '/') {
|
||||
$this->options['path'] .= '/';
|
||||
if (substr($this->options['path'], -1) != DS) {
|
||||
$this->options['path'] .= DS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
21
core/library/think/cache/driver/Memcached.php
vendored
21
core/library/think/cache/driver/Memcached.php
vendored
@@ -12,19 +12,18 @@
|
||||
namespace think\cache\driver;
|
||||
|
||||
use think\Cache;
|
||||
use think\Exception;
|
||||
|
||||
class Memcached
|
||||
{
|
||||
protected $handler = null;
|
||||
protected $handler;
|
||||
protected $options = [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'expire' => 0,
|
||||
'timeout' => 0, // 超时时间(单位:毫秒)
|
||||
'prefix' => '',
|
||||
'username' => '', //账号
|
||||
'password' => '', //密码
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'expire' => 0,
|
||||
'timeout' => 0, // 超时时间(单位:毫秒)
|
||||
'prefix' => '',
|
||||
'username' => '', //账号
|
||||
'password' => '', //密码
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -57,9 +56,9 @@ class Memcached
|
||||
$servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1];
|
||||
}
|
||||
$this->handler->addServers($servers);
|
||||
if('' != $this->options['username']){
|
||||
if ('' != $this->options['username']) {
|
||||
$this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$this->handler->setSaslAuthData($this->options['username'], $this->options['password']);
|
||||
$this->handler->setSaslAuthData($this->options['username'], $this->options['password']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
122
core/library/think/cache/driver/Sae.php
vendored
122
core/library/think/cache/driver/Sae.php
vendored
@@ -1,122 +0,0 @@
|
||||
<?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\cache\driver;
|
||||
|
||||
use think\Cache;
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* SAE Memcache缓存驱动
|
||||
* @author liu21st <liu21st@gmail.com>
|
||||
*/
|
||||
class Sae
|
||||
{
|
||||
protected $handler = null;
|
||||
protected $options = [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'expire' => 0,
|
||||
'timeout' => false,
|
||||
'persistent' => false,
|
||||
'prefix' => '',
|
||||
];
|
||||
|
||||
/**
|
||||
* 架构函数
|
||||
* @param array $options 缓存参数
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($options = [])
|
||||
{
|
||||
if (!function_exists('memcache_init')) {
|
||||
throw new \BadFunctionCallException('must run at sae');
|
||||
}
|
||||
$this->handler = memcache_init();
|
||||
if (!$this->handler) {
|
||||
throw new Exception('memcache init error');
|
||||
}
|
||||
if (!empty($options)) {
|
||||
$this->options = array_merge($this->options, $options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
return $this->handler->get($_SERVER['HTTP_APPVERSION'] . '/' . $this->options['prefix'] . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return bool
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
{
|
||||
if (is_null($expire)) {
|
||||
$expire = $this->options['expire'];
|
||||
}
|
||||
$name = $this->options['prefix'] . $name;
|
||||
if ($this->handler->set($_SERVER['HTTP_APPVERSION'] . '/' . $name, $value, 0, $expire)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
* @param string $name 缓存变量名
|
||||
* @param bool|false $ttl
|
||||
* @return bool
|
||||
*/
|
||||
public function rm($name, $ttl = false)
|
||||
{
|
||||
$name = $_SERVER['HTTP_APPVERSION'] . '/' . $this->options['prefix'] . $name;
|
||||
return false === $ttl ?
|
||||
$this->handler->delete($name) :
|
||||
$this->handler->delete($name, $ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除缓存
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
return $this->handler->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得SaeKv对象
|
||||
*/
|
||||
private function getKv()
|
||||
{
|
||||
static $kv;
|
||||
if (!$kv) {
|
||||
$kv = new \SaeKV();
|
||||
if (!$kv->init()) {
|
||||
throw new Exception('KVDB init error');
|
||||
}
|
||||
}
|
||||
return $kv;
|
||||
}
|
||||
|
||||
}
|
||||
2
core/library/think/cache/driver/Sqlite.php
vendored
2
core/library/think/cache/driver/Sqlite.php
vendored
@@ -18,7 +18,7 @@ use think\Exception;
|
||||
* Sqlite缓存驱动
|
||||
* @author liu21st <liu21st@gmail.com>
|
||||
*/
|
||||
class Sqlite implements CacheInterface
|
||||
class Sqlite
|
||||
{
|
||||
|
||||
protected $options = [
|
||||
|
||||
Reference in New Issue
Block a user