ArgumentCountError: key() expects exactly 1 argument, 2 given in E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\redis\src\Client.php:421
Stack trace:
#0 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\redis\src\Client.php(421): key(false, Object(Workerman\Redis\Client))
#1 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\workerman\src\Connection\TcpConnection.php(711): Workerman\Redis\Client->Workerman\Redis\{closure}(Object(Workerman\Connection\AsyncTcpConnection), Array)
#2 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\workerman\src\Events\Revolt.php(146): Workerman\Connection\TcpConnection->baseRead(Resource id #248)
#3 E:\phpstudy_pro\WWW\activity\mst\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(571): Workerman\Events\Revolt->Workerman\Events\{closure}('g', Resource id #248)
#4 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#5 E:\phpstudy_pro\WWW\activity\mst\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(478): Fiber->resume()
#6 E:\phpstudy_pro\WWW\activity\mst\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(533): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#7 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#8 E:\phpstudy_pro\WWW\activity\mst\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(105): Fiber->start()
#9 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\workerman\src\Events\Revolt.php(88): Revolt\EventLoop\Internal\AbstractDriver->run()
#10 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\workerman\src\Worker.php(1444): Workerman\Events\Revolt->run()
#11 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\workerman\src\Worker.php(1365): Workerman\Worker::forkWorkersForWindows()
#12 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\workerman\src\Worker.php(572): Workerman\Worker::forkWorkers()
#13 E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\webman-framework\src\support\App.php(131): Workerman\Worker::runAll()
#14 E:\phpstudy_pro\WWW\activity\mst\start.php(4): support\App::run()
#15 {main}
發(fā)下能重現(xiàn)問(wèn)題的代碼
發(fā)下能重現(xiàn)問(wèn)題的代碼
<?php
namespace app\home\controller;
use support\exception\BusinessException;
use support\Request;
use lib\ExcelRead;
use support\Redis;
use support\Container;
use lib\RateLimiting;
use support\Db;
use Workerman\Redis\Client;
class IndexController extends Base
{
private $redis;
function __construct(){
$this->redis = new Client('redis://' . envs('REDIS_HOST') . ':' . envs('REDIS_PORT'));
$this->redis->auth(envs('REDIS_PASSWORD'));
$this->redis->select(envs('REDIS_DATABASE'));
}
public function view(Request $request)
{
$r = $this->redis->get('key');
return $this->json(0,'success',['data' => $r]);
// $data = RateLimiting::getDbByLock('101_log','fuck',60,function(){
// return (array)Db::table('tp_101_log')->where('id',138)->first();
// });
// return $this->json(0,'success',$data);
}
}
請(qǐng)求 view方法 就后臺(tái)報(bào)錯(cuò)了
ArgumentCountError: key() expects exactly 1 argument, 2 given in E:\phpstudy_pro\WWW\activity\mst\vendor\workerman\redis\src\Client.php:421
Stack trace:
老哥我有個(gè)疑問(wèn)啊,workerman-redis處理常規(guī)redis get、set穩(wěn)定么?可以用于生產(chǎn)環(huán)境嗎?根據(jù)手冊(cè)上寫(xiě)的,除非要使用異步訂閱功能,否則最好使用phpredis擴(kuò)展,以獲得更好的性能。
workerman/redis 沒(méi)有看到說(shuō)不穩(wěn)定的反饋。
不過(guò)get set建議用redis擴(kuò)展,性能和workerman/redis區(qū)別不大,用法大家都熟悉。
workerman/redis官方開(kāi)發(fā)出來(lái)主要是用來(lái)處理非阻塞訂閱的。