我只使用了文档示例,但得到了错误exception 'Predis\ClientException' with message 'Command 'THROTTLE' is not a registered Redis command.
我搜索了很多关于redis命令的东西,但是没有关于throttle的。
public function handle()
{
// Allow only 2 emails every 1 second
Redis::throttle('my-mailtrap')->allow(2)->every(1)->then(function () {
$recipient = 'steven@example.com';
Mail::to($recipient)->send(new OrderShipped($this->order));
Log::info('Emailed order ' . $this->order->id);
}, function () {
// Could not obtain lock; this job will be re-queued
return $this->release(2);
});
}我该怎么做?有什么帮助吗,谢谢!
发布于 2019-06-20 12:24:36
在Illuminate/Redis/Connections/PredisConnection中定义了throttle方法。
Redis外观允许您使用以下命令获取连接
Redis::connection()
->throttle('my-mailtrap')
//...http://laravel.com/docs/5.8/redis
https://stackoverflow.com/questions/56678665
复制相似问题