Skip to content

Commit 8f982ce

Browse files
[12.x] PredisClusterConnection::keys() (#57841)
* [12.x] unskip tests * [12.x] keys for PredisClusterConnection * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent f00b6dd commit 8f982ce

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

src/Illuminate/Redis/Connections/PredisClusterConnection.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77

88
class PredisClusterConnection extends PredisConnection
99
{
10+
/**
11+
* Get the keys that match the given pattern.
12+
*
13+
* @param string $pattern
14+
* @return array
15+
*/
16+
public function keys(string $pattern)
17+
{
18+
$keys = [];
19+
20+
foreach ($this->client as $node) {
21+
$keys[] = $node->keys($pattern);
22+
}
23+
24+
return array_merge(...$keys);
25+
}
26+
1027
/**
1128
* Flush the selected Redis database on all cluster nodes.
1229
*

tests/Integration/Cache/RedisStoreTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ public function testTagEntriesCanBeIncremented()
148148

149149
public function testIncrementedTagEntriesProperlyTurnStale()
150150
{
151-
$this->markTestSkippedWithPredisClusterConnection();
152-
153151
Cache::store('redis')->clear();
154152

155153
Cache::store('redis')->tags(['votes'])->add('person-1', 0, $seconds = 1);
@@ -166,8 +164,6 @@ public function testIncrementedTagEntriesProperlyTurnStale()
166164

167165
public function testPastTtlTagEntriesAreNotAdded()
168166
{
169-
$this->markTestSkippedWithPredisClusterConnection();
170-
171167
Cache::store('redis')->clear();
172168

173169
Cache::store('redis')->tags(['votes'])->add('person-1', 0, new DateTime('yesterday'));
@@ -181,8 +177,6 @@ public function testPastTtlTagEntriesAreNotAdded()
181177

182178
public function testPutPastTtlTagEntriesProperlyTurnStale()
183179
{
184-
$this->markTestSkippedWithPredisClusterConnection();
185-
186180
Cache::store('redis')->clear();
187181

188182
Cache::store('redis')->tags(['votes'])->put('person-1', 0, new DateTime('yesterday'));
@@ -194,8 +188,6 @@ public function testPutPastTtlTagEntriesProperlyTurnStale()
194188

195189
public function testTagsCanBeFlushedBySingleKey()
196190
{
197-
$this->markTestSkippedWithPredisClusterConnection();
198-
199191
Cache::store('redis')->clear();
200192

201193
Cache::store('redis')->tags(['people', 'author'])->put('person-1', 'Sally', 5);
@@ -212,8 +204,6 @@ public function testTagsCanBeFlushedBySingleKey()
212204

213205
public function testStaleEntriesCanBeFlushed()
214206
{
215-
$this->markTestSkippedWithPredisClusterConnection();
216-
217207
Cache::store('redis')->clear();
218208

219209
Cache::store('redis')->tags(['people', 'author'])->put('person-1', 'Sally', 1);

0 commit comments

Comments
 (0)