Skip to content

[Lock] cache pool as lock resource doesn't work #61128

@faizanakram99

Description

@faizanakram99

Symfony version(s) affected

7.3.0

Description

As per docs, lock resouce can be dsn or service id, but service id doesn't work. It is throwing "Unsupported Connection: shared.cache" error.

Here is my cache config.

<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Config\FrameworkConfig;

return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $frameworkConfig): void {
    $cacheConfig = $frameworkConfig->cache();

    $cacheConfig
        ->defaultRedisProvider('%env(REDIS_URL)%')
        ->prefixSeed('qbil-trade.%kernel.environment%')
        ->app('cache.adapter.redis')
        ->system('cache.adapter.system');

    $cacheConfig
        ->pool('shared.cache')
        ->adapters(['cache.adapter.redis']);
};

And here is my lock config

<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $frameworkConfig): void {
    $frameworkConfig
        ->lock()
        ->resource('default', ['%env(LOCK_DSN)%']);

    $frameworkConfig
        ->lock()
        ->resource('shared', ['shared.cache']);
};

shared.cache is service id (debug:container shows it too)

How to reproduce

Configure cache pools like the example above and use a pool as lock resource, it won't work.

Possible Solution

No response

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