think-orm
think-orm copied to clipboard
thinkorm + thinkcache ->cache(true) error
error: Return value of think\db\PDOConnection::pdoQuery() must be of the type array, bool returned file: /vendor/topthink/think-orm/src/db/PDOConnection.php line: 695
old
if ($query->getOptions('cache')) {
// 检查查询缓存
$cacheItem = $this->parseCache($query, $query->getOptions('cache'));
$key = $cacheItem->getKey();
$data = $this->cache->get($key);
if (null !== $data) {
return $data;
}
}
new
if ($query->getOptions('cache')) {
// 检查查询缓存
$cacheItem = $this->parseCache($query, $query->getOptions('cache'));
$key = $cacheItem->getKey();
$data = $this->cache->get($key, null);
if (null !== $data) {
return $data;
}
}
think\facade\Db::setCache(\think\facade\Cache::store());
$user = User::where('id', 1)->cache(60)->find();
确实是这样的.我刚刚也遇到了同样的问题.希望官方改一下. @liu21st