升级ThinkPHP到6.0.1
This commit is contained in:
1 parent
c429547ff1
commit
fc62c7c8a2
33 files changed
+383
-303
No files matched your search
+4
-3
@@ -18,6 +18,7 @@ use DateTime;
|
||||
use DateTimeInterface;
|
||||
use Exception;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use think\Container;
|
||||
use think\contract\CacheHandlerInterface;
|
||||
use think\exception\InvalidArgumentException;
|
||||
use throwable;
|
||||
@@ -156,7 +157,7 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface
|
||||
|
||||
if ($value instanceof Closure) {
|
||||
// 获取缓存数据
|
||||
$value = $value();
|
||||
$value = Container::getInstance()->invokeFunction($value);
|
||||
}
|
||||
|
||||
// 缓存数据
|
||||
@@ -227,7 +228,7 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface
|
||||
return (string) $data;
|
||||
}
|
||||
|
||||
$serialize = $this->options['serialize'][0] ?? "\Opis\Closure\serialize";
|
||||
$serialize = $this->options['serialize'][0] ?? "serialize";
|
||||
|
||||
return $serialize($data);
|
||||
}
|
||||
@@ -244,7 +245,7 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
$unserialize = $this->options['serialize'][1] ?? "\Opis\Closure\unserialize";
|
||||
$unserialize = $this->options['serialize'][1] ?? "unserialize";
|
||||
|
||||
return $unserialize($data);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class Memcache extends Driver
|
||||
foreach ($hosts as $i => $host) {
|
||||
$port = $ports[$i] ?? $ports[0];
|
||||
$this->options['timeout'] > 0 ?
|
||||
$this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, $this->options['timeout']) :
|
||||
$this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, (int) $this->options['timeout']) :
|
||||
$this->handler->addServer($host, (int) $port, $this->options['persistent'], 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,15 +181,18 @@ class Memcached extends Driver
|
||||
* 删除缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param bool|false $ttl
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($name): bool
|
||||
public function delete($name, $ttl = false): bool
|
||||
{
|
||||
$this->writeTimes++;
|
||||
|
||||
$key = $this->getCacheKey($name);
|
||||
|
||||
return $this->handler->delete($key);
|
||||
return false === $ttl ?
|
||||
$this->handler->delete($key) :
|
||||
$this->handler->delete($key, $ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loaded 3 of 33 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user