-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Cache ChainAdapter not working in SF 4.0.8 #26954
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
Comments
Can confirm the issue. There is a "namespace" forced as the first argument here: Seems |
I suppose the current doc could be improved. Would you mind opening a PR doing so?
So, if you want to override the |
Thank you for the insight. I'll be happy to open a PR to the ChainAdapter docs. I'd appreciate some additional clarification first though. I got it working with the config below. I believe that's what you suggested in your comment. However I'm wondering if it can be simplified. Can the chain adapter be configured in framework.cache without adding a service definition? Since the only thing that service is doing is passing the apcu and redis adapters as arguments. # framework.cache
pools:
app.cache.apcu:
adapter: cache.adapter.apcu
default_lifetime: 86400
app.cache.redis:
adapter: cache.adapter.redis
default_lifetime: 86400
# services.yaml
cache.app:
class: Symfony\Component\Cache\Adapter\ChainAdapter
arguments:
$adapters: ['@app.cache.apcu', '@app.cache.redis'] |
Yes, that's exactly what I suggested.
You're missing the name of the pools, from which a namespace is derivated. |
I tried this config, without the service pools:
app.cache.apcu:
name: cache.app.apcu
adapter: cache.adapter.apcu
default_lifetime: 86400
app.cache.redis:
name: cache.app.redis
adapter: cache.adapter.redis
default_lifetime: 86400 However, when I debug the container I get two different TraceableAdapter services. e.g.
When I manually defined the service overwriting cache.app, I was getting the expected ChainAdapter
I'm not sure if I'm missing something in my pools config. I tried using the same name for both hoping that the two adapters in the same namespace would be put together in a ChainAdapter but instead I get a DuplicateKeyException. |
Real pool are wrapped in a TraceableAdapter to make the profiler panel work for them. All is fine :) |
I've been attempting to set up a successful ChainAdapter for days without success. I've read all the docs and looked for help online and I have not come across anyone that set up a successful ChainAdapter in the config. I asked for help in the symfony-dev slack channel and some people there said it was very likely a bug with the ChainAdapter.
When attempting to set up a Cache ChainAdapter with Apcu and Redis. I get this error:
I tried other variations of the config, such as:
and that gives me this other error:
I've had other people look into this and they get the same errors, so I know it's not an issue related to my specific environment.
Thank you.
The text was updated successfully, but these errors were encountered: