Skip to content

Commit

Permalink
Update GraphqliteCompilserPass to use Symfony cache
Browse files Browse the repository at this point in the history
Fixes #74
  • Loading branch information
MattBred committed Nov 23, 2020
1 parent 25b681e commit 9f22eca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion DependencyInjection/GraphqliteCompilerPass.php
Expand Up @@ -91,12 +91,18 @@ class GraphqliteCompilerPass implements CompilerPassInterface
*/
private $annotationReader;

/**
* @var string
*/
private $cacheDir;

/**
* You can modify the container here before it is dumped to PHP code.
*/
public function process(ContainerBuilder $container): void
{
$reader = $this->getAnnotationReader();
$this->cacheDir = $container->getParameter('kernel.cache_dir');
//$inputTypeUtils = new InputTypeUtils($reader, $namingStrategy);

// Let's scan the whole container and tag the services that belong to the namespace we want to inspect.
Expand Down Expand Up @@ -442,7 +448,7 @@ private function getPsr16Cache(): CacheInterface
if (function_exists('apcu_fetch')) {
$this->cache = new Psr16Cache(new ApcuAdapter('graphqlite_bundle'));
} else {
$this->cache = new Psr16Cache(new PhpFilesAdapter('graphqlite_bundle'));
$this->cache = new Psr16Cache(new PhpFilesAdapter('graphqlite_bundle', 0, $this->cacheDir));
}
}
return $this->cache;
Expand Down

0 comments on commit 9f22eca

Please sign in to comment.