Skip to content

[Lock] - pass redis connection #53845

Open
@vencakrecl

Description

@vencakrecl

Symfony version(s) affected

7.0.3

Description

The StoreFactory can receive object or string but the lock configuration allow use only string. StoreFactory::create can use instance of connection (\Redis, \RedisCluster, etc.)

public static function createStore(#[\SensitiveParameter] object|string $connection): PersistingStoreInterface

How to reproduce

framework:
  lock:
    enabled: true
    resources:
      - '@cache.provider.redis'
      
services:
    cache.provider.redis:
      class: \Redis # no matter what the factory returns
      factory: [ 'Symfony\Component\Cache\Adapter\RedisAdapter', 'createConnection' ]
      arguments:
        - 'redis://redis:6379'

Possible Solution

\Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension::registerLockConfiguration the extension should pass service here.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions