We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b369784 commit ad5ed80Copy full SHA for ad5ed80
src/Throttle.php
@@ -68,11 +68,11 @@ class Throttle
68
69
/**
70
* Throttle constructor.
71
- * @param Cache $cache
72
* @param Config $config
73
*/
74
public function __construct(Config $config)
75
{
+ $this->cache = null;
76
$this->config = array_merge(static::$default_config, $config->load('throttle', 'throttle'));
77
}
78
@@ -125,8 +125,9 @@ protected function allowRequest(Request $request)
125
126
public function handle(Request $request, Closure $next)
127
128
- $this->cache = app('cache');
129
-
+ if ($this->cache == null) {
+ $this->cache = app('cache');
130
+ }
131
$allow = $this->allowRequest($request);
132
if (!$allow) {
133
// 访问受限
0 commit comments