diff --git a/src/Spiritix/LadaCache/Invalidator.php b/src/Spiritix/LadaCache/Invalidator.php index 956333b..7b31d07 100644 --- a/src/Spiritix/LadaCache/Invalidator.php +++ b/src/Spiritix/LadaCache/Invalidator.php @@ -70,7 +70,7 @@ private function getHashes(array $tags) continue; } - $hashes += $this->redis->smembers($tag); + $hashes = array_merge($hashes, $this->redis->smembers($tag)); } return array_unique($hashes); @@ -88,4 +88,4 @@ private function deleteItems(array $items) $this->redis->del($item); } } -} \ No newline at end of file +} diff --git a/tests/InvalidatorTest.php b/tests/InvalidatorTest.php index 2b81203..1f4bec4 100644 --- a/tests/InvalidatorTest.php +++ b/tests/InvalidatorTest.php @@ -24,4 +24,14 @@ public function testInvalidate() $this->assertFalse($this->cache->has('key')); } -} \ No newline at end of file + + public function testInvalidateMultiTags() + { + $this->cache->set('key1', ['tag1'], 'data'); + $this->cache->set('key2', ['tag2'], 'data'); + + $this->invalidator->invalidate(['tag1', 'tag2']); + + $this->assertFalse($this->cache->has('key2')); + } +}