Skip to content

Commit f4333d8

Browse files
committed
Use the optimized FilesystemTagAwareAdapter by default if available
1 parent bea31d5 commit f4333d8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Psr6Store.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Psr\Cache\InvalidArgumentException;
1515
use Symfony\Component\Cache\Adapter\AdapterInterface;
1616
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
17+
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
1718
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
1819
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
1920
use Symfony\Component\Cache\PruneableInterface;
@@ -122,6 +123,11 @@ public function __construct(array $options = [])
122123
throw new MissingOptionsException('The cache_directory option is required unless you set the cache explicitly');
123124
}
124125

126+
// As of Symfony 4.3+ we can use the optimized FilesystemTagAwareAdapter
127+
if (class_exists(FilesystemTagAwareAdapter::class)) {
128+
return new FilesystemTagAwareAdapter('', 0, $options['cache_directory']);
129+
}
130+
125131
return new TagAwareAdapter(
126132
new FilesystemAdapter('', 0, $options['cache_directory'])
127133
);

0 commit comments

Comments
 (0)