Skip to content

Commit e9779ba

Browse files
committed
Refactor flushByPattern() to use withConnection()
Simplifies the implementation by delegating to the newly added withConnection() method instead of manually managing pool operations.
1 parent ff59427 commit e9779ba

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/redis/src/Redis.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,8 @@ public function connection(string $name = 'default'): RedisProxy
190190
*/
191191
public function flushByPattern(string $pattern): int
192192
{
193-
$pool = $this->factory->getPool($this->poolName);
194-
195-
/** @var RedisConnection $connection */
196-
$connection = $pool->get();
197-
198-
try {
199-
return $connection->flushByPattern($pattern);
200-
} finally {
201-
$connection->release();
202-
}
193+
return $this->withConnection(
194+
fn (RedisConnection $connection) => $connection->flushByPattern($pattern)
195+
);
203196
}
204197
}

0 commit comments

Comments
 (0)