-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configless metadata caching #685
Add configless metadata caching #685
Conversation
// Convert to PSR-6 cache if required | ||
$cacheServiceId = $this->getObjectManagerElementName($documentManager['name'] . '_metadata_cache'); | ||
$cacheDefinition = $container->getDefinition($cacheServiceId); | ||
if (is_a($cacheDefinition->getClass(), CacheItemPoolInterface::class, true)) { | ||
return; | ||
} | ||
|
||
$adapterDefinition = new Definition(CacheItemPoolInterface::class); | ||
$adapterDefinition | ||
->setFactory([CacheAdapter::class, 'wrap']) | ||
->setArgument(0, $cacheDefinition); | ||
|
||
$container->setDefinition($cacheServiceId, $adapterDefinition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part won't work like that, as we can't check the cache definitions class at this stage. In DoctrineBundle, we worked around this by adding a compiler pass that converts caches to the correct instance: https://github.com/doctrine/DoctrineBundle/blob/2.4.x/DependencyInjection/Compiler/CacheCompatibilityPass.php
ODM only has metadata caching, so we don't need to account for other caches like we do for ORM, but the logic can stay the same.
In the extension, we then set up the metadata cache layer the way it has been, with the compiler pass ensuring that the correct cache instance is passed to the configuration.
Implementing psr6 compatibility pass in this pr |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions. |
Quoting @alcaeus description of the related PR #675