Skip to content

Commit

Permalink
Merge pull request #1397 from doctrine/second-level-cache-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky authored Sep 9, 2021
2 parents a60f8bc + 64234c7 commit c394f20
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions DependencyInjection/Compiler/CacheCompatibilityPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ private function updateSecondLevelCache(ContainerBuilder $container, Definition
assert($factoryDefinition instanceof Definition);
$aliasId = (string) $factoryDefinition->getArgument(1);
$this->wrapIfNecessary($container, $aliasId, (string) $container->getAlias($aliasId), false);
foreach ($factoryDefinition->getMethodCalls() as $factoryMethodCall) {
if ($factoryMethodCall[0] !== 'setRegion') {
continue;
}

$driverId = (string) $container->getDefinition($factoryMethodCall[1][0])->getArgument(1);
if (! $container->hasAlias($driverId)) {
continue;
}

$this->wrapIfNecessary($container, $driverId, (string) $container->getAlias($driverId), false);
}

break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
'orm' => [
'query_cache_driver' => ['type' => 'service', 'id' => 'custom_cache_service'],
'result_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool'],
'second_level_cache' => [
'enabled' => true,
'regions' => [
'lifelong' => ['lifetime' => 0, 'cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool']],
],
],
],
]
);
Expand Down

0 comments on commit c394f20

Please sign in to comment.