Skip to content

Commit 91270f1

Browse files
committed
Merge branch 'Plytas/8.x' into 8.x
2 parents c2dd983 + bc638c3 commit 91270f1

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/Illuminate/Cache/RedisTaggedCache.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ public function flush()
8989
$this->deleteForeverKeys();
9090
$this->deleteStandardKeys();
9191

92-
return parent::flush();
92+
$this->tags->flush();
93+
94+
return true;
9395
}
9496

9597
/**

src/Illuminate/Cache/TagSet.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ public function resetTag($name)
5656
return $id;
5757
}
5858

59+
/**
60+
* Flush all the tags in the set.
61+
*
62+
* @return void
63+
*/
64+
public function flush()
65+
{
66+
array_walk($this->names, [$this, 'flushTag']);
67+
}
68+
69+
/**
70+
* Flush the tag from the cache.
71+
*
72+
* @param string $name
73+
*/
74+
public function flushTag($name)
75+
{
76+
$this->store->forget($this->tagKey($name));
77+
}
78+
5979
/**
6080
* Get a unique namespace that changes when any of the tags are flushed.
6181
*

tests/Cache/CacheTaggedCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function testRedisCacheTagsCanBeFlushed()
282282
$conn->shouldReceive('del')->once()->with('prefix:foo:standard_ref');
283283
$conn->shouldReceive('del')->once()->with('prefix:bar:standard_ref');
284284

285-
$tagSet->shouldReceive('reset')->once();
285+
$tagSet->shouldReceive('flush')->once();
286286

287287
$redis->flush();
288288
}

0 commit comments

Comments
 (0)