I want to use Doctrine DBAL Cache Adapter as a fallback cache to my other cache options to store external data. Not to store doctrine db results!
The documentation gives me this:
https://symfony.com/doc/6.4/components/cache/adapters/doctrine_dbal_adapter.html
However I don’t find any information if I have to create the caching table myself. Do I? Or is it created automatically? Do I have to choose a name for the table? Is there a standard? How do I pass in my default db connection?
What I have done so far is I configured it as a part of my already complex caching configuration:
framework:
cache:
system: cache.adapter.filesystem
app: cache.adapter.filesystem
pools:
cache.sap:
adapter: cache.adapter.filesystem
cache.pers:
adapter: cache.adapter.filesystem
cache.db: # <-- this is the new one
adapter: app.cache.adapter.db_cache
services:
app.cache.adapter.db_cache:
parent: 'cache.adapter.doctrine_dbal'
tags:
- { name: 'cache.pool', namespace: 'sapData', default_lifetime: '0' }
cache.db being the new db cache I want to use.
I also have set up the saving and fetching of the data in the code.
What I haven’t found is any current example configuration of a setup.
I found examples for the PDO cache like this: Symfony3: How to enable PDO/Doctrine cache adapter, the right way?
But this is symfony3 and other examples are even older.