Skip to content
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

How to customize the DoctrineDbalAdapter cache adapter #20197

Open
pauljura opened this issue Sep 4, 2024 · 0 comments
Open

How to customize the DoctrineDbalAdapter cache adapter #20197

pauljura opened this issue Sep 4, 2024 · 0 comments
Labels

Comments

@pauljura
Copy link

pauljura commented Sep 4, 2024

Hi, I recently added login throttling to my site and was trying to customize the table name with the DoctrineDbalAdapter to fit with the naming convention of an existing database. I checked here: https://symfony.com/doc/current/components/cache/adapters/doctrine_dbal_adapter.html and here: https://symfony.com/doc/current/cache.html#custom-provider-options

Ultimately I got the answer from here: symfony/symfony#58168

The final complete solution for me was:

# config/packages/cache.yaml
framework:
  cache:
    app: my_adapter
    pools:
        login_throttling.cache:
            adapter: my_adapter
# config/services.yaml
services:
  my_adapter:
    parent: cache.adapter.doctrine_dbal
    arguments:
      $connOrDsn: '@database_connection'
      $options:
        db_table: my_adapter_table

Would be nice to have this documented in the appropriate place. Thanks!

@xabbuh xabbuh added the Cache label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants