Skip to content

Commit b14cfc9

Browse files
committed
formatting
1 parent b54e4e5 commit b14cfc9

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

src/Illuminate/Redis/Connections/Connection.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Illuminate\Redis\Connections;
44

55
use Closure;
6-
use Illuminate\Redis\Events\QueryExecuted;
76
use Illuminate\Contracts\Events\Dispatcher;
7+
use Illuminate\Redis\Events\CommandExecuted;
88
use Illuminate\Redis\Limiters\DurationLimiterBuilder;
99
use Illuminate\Redis\Limiters\ConcurrencyLimiterBuilder;
1010

@@ -21,18 +21,18 @@ abstract class Connection
2121
protected $client;
2222

2323
/**
24-
* The event dispatcher instance.
24+
* The Redis connection name.
2525
*
26-
* @var \Illuminate\Contracts\Events\Dispatcher
26+
* @var string|null
2727
*/
28-
protected $events;
28+
protected $name;
2929

3030
/**
31-
* The Redis connection name.
31+
* The event dispatcher instance.
3232
*
33-
* @var string|null
33+
* @var \Illuminate\Contracts\Events\Dispatcher
3434
*/
35-
protected $name;
35+
protected $events;
3636

3737
/**
3838
* Subscribe to a set of given channels for messages.
@@ -110,11 +110,13 @@ public function psubscribe($channels, Closure $callback)
110110
public function command($method, array $parameters = [])
111111
{
112112
$start = microtime(true);
113+
113114
$result = $this->client->{$method}(...$parameters);
115+
114116
$time = round((microtime(true) - $start) * 1000, 2);
115117

116118
if (isset($this->events)) {
117-
$this->event(new QueryExecuted($method, $parameters, $time, $this));
119+
$this->event(new CommandExecuted($method, $parameters, $time, $this));
118120
}
119121

120122
return $result;
@@ -134,15 +136,15 @@ protected function event($event)
134136
}
135137

136138
/**
137-
* Register a Redis query listener with the connection.
139+
* Register a Redis command listener with the connection.
138140
*
139141
* @param \Closure $callback
140142
* @return void
141143
*/
142144
public function listen(Closure $callback)
143145
{
144146
if (isset($this->events)) {
145-
$this->events->listen(QueryExecuted::class, $callback);
147+
$this->events->listen(CommandExecuted::class, $callback);
146148
}
147149
}
148150

src/Illuminate/Redis/Events/QueryExecuted.php renamed to src/Illuminate/Redis/Events/CommandExecuted.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Illuminate\Redis\Events;
44

5-
class QueryExecuted
5+
class CommandExecuted
66
{
77
/**
88
* The Redis command that was executed.
@@ -12,14 +12,14 @@ class QueryExecuted
1212
public $command;
1313

1414
/**
15-
* The array of query parameters.
15+
* The array of command parameters.
1616
*
1717
* @var array
1818
*/
1919
public $parameters;
2020

2121
/**
22-
* The number of milliseconds it took to execute the query.
22+
* The number of milliseconds it took to execute the command.
2323
*
2424
* @var float
2525
*/

src/Illuminate/Redis/RedisManager.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class RedisManager implements Factory
4444
*
4545
* @var bool
4646
*/
47-
protected $events = true;
47+
protected $events = false;
4848

4949
/**
5050
* Create a new Redis manager instance.
@@ -121,7 +121,7 @@ protected function resolveCluster($name)
121121
}
122122

123123
/**
124-
* Get the connector instance for the current driver.
124+
* Configure the given connection to prepare it for commands.
125125
*
126126
* @param \Illuminate\Redis\Connections\Connection $connection
127127
* @param string $name
@@ -132,7 +132,7 @@ protected function configure(Connection $connection, $name)
132132
$connection->setName($name);
133133

134134
if ($this->events && $this->app->bound('events')) {
135-
$connection->setEventDispatcher($this->app['events']);
135+
$connection->setEventDispatcher($this->app->make('events'));
136136
}
137137

138138
return $connection;
@@ -164,23 +164,23 @@ public function connections()
164164
}
165165

166166
/**
167-
* Enable setting event dispatcher on connections.
167+
* Enable the firing of Redis command events.
168168
*
169-
* @return array
169+
* @return void
170170
*/
171171
public function enableEvents()
172172
{
173-
return $this->events = true;
173+
$this->events = true;
174174
}
175175

176176
/**
177-
* Disable setting event dispatcher on connections.
177+
* Disable the firing of Redis command events.
178178
*
179-
* @return array
179+
* @return void
180180
*/
181181
public function disableEvents()
182182
{
183-
return $this->events = false;
183+
$this->events = false;
184184
}
185185

186186
/**

0 commit comments

Comments
 (0)