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
Fix for using cache pools with multiple areas #2232
Conversation
6ba7006
to
24edba5
Compare
Let's deprecate the
I don't think we should do this. |
Alright. I'll move it to areas 👍 |
24edba5
to
661e530
Compare
Looking at the per area implementation that you made I think it won't be necessary to deprecate the old cache configuration.
I also fully take this back (my bad 😅) the old behaviour (before the cache option was implemented #2225) was already broken if someone if someone did the following:
Doing above these steps would also result in the cache to be shared between areas. |
How about this:
so basically global config is used as fallback if area-specific config is not defined i could have something like this nelmio_api_doc:
cache:
pool: app.cache
areas:
default:
cache:
item_id: docs
area2:
cache:
item_id: docs2
... same pool, different item ids |
i'm just not sure how to fit auto appending area to cache key into this logic |
Looks good to me! Below are some more configuration combinations I can think of which seem reasonable to allow: # Uses default `item_id` (openapi_docs) and appends the area => `openapi_docs.default`, `openapi_docs.area1`
nelmio_api_doc:
cache:
pool: app.cache
areas:
default:
... # Only apply cache on a single area
nelmio_api_doc:
areas:
default:
...
area2:
cache:
pool: app.cache
item_id: docs
... # Sharing cache between areas
nelmio_api_doc:
cache:
pool: app.cache
areas:
default: # Uses cache from global
...
area2:
cache:
item_id: shared_cache_id
shared_area:
cache:
item_id: shared_cache_id
... |
I think we should. I can also create something for this really quick |
c8e7c8f |
24cef8b
to
77ea24a
Compare
Thank you @Brajk19! |
#2225 enabled usage of cache pools.
I noticed a problem when using this with multiple areas.
If i have configuration with
area1
andarea2
, depending on which ApiDocGenerator is called first, its specification will be cached and all following generators (for any area) will return that cached response because same item id is used.Defining global cache (for all areas) is deprecated and all cache config should be area specific.