Skip to content

How to customize the DoctrineDbalAdapter cache adapter #20197

Open
@pauljura

Description

@pauljura

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions