-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow to set a cache to store configuration #2373
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2373 +/- ##
============================================
+ Coverage 80.91% 81.00% +0.08%
- Complexity 3150 3152 +2
============================================
Files 159 159
Lines 8149 8160 +11
============================================
+ Hits 6594 6610 +16
+ Misses 1555 1550 -5
Continue to review full report at Codecov.
|
// Cache the result, even if it's empty, to prevent re-parsing non-existent annotations. | ||
$cacheId = self::getCacheId($className, $this->extensionNamespace); | ||
|
||
if (null === $this->cachePoolItem) { |
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.
Move this up? No point in computing a cache ID if the cache pool isn't set.
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.
thanks! in a previous version I was setting the configuration to the metadata cache when $this->cachePoolItem
was null I forgot to move it again.
474ca92
to
72b1e69
Compare
7e70827
to
4039035
Compare
Thanks @franmomu! |
Fixes #2365, #2227
Instead of relying on the metadata cache from the orm/odm, this PR adds a
MappedEventSubscriber::setCacheItemPool()
method to configure the cache service, in case it is not provided it uses anArrayAdapter
(this will invalidate existing caches).For the bundle, a service can be created (allowing users to configure their own) and call
setCacheItemPool
in every definition assetAnnotationReader
(https://github.com/stof/StofDoctrineExtensionsBundle/blob/a2bffca41974d1c968557b343e269a60a8d5ffa4/src/Resources/config/blameable.xml#L13-L15)AbstractClassMetadataFactory::getCacheDriver()
that we have to figure out what to do(Make users add mapping to tree closure entities #2390).