Skip to content

[FrameworkBundle] missing integration of PSR-16 simple cache #28918

Closed
@Tobion

Description

@Tobion

Description
Cache pools can easily be configured in the framework bundle with

framework:
    cache:
        pools:
            cache.pool1:
                adapter: cache.adapter.redis
            cache.pool2:
                adapter: cache.adapter.redis

But all the cache services created only implement PSR-6 Psr\Cache\CacheItemPoolInterface. We would like to use PSR-16 Psr\SimpleCache\CacheInterface instead. Currently the only solution seems to be to wrap all the pools in an adapter like

services:
    cache.simple.pool1:
        class: Symfony\Component\Cache\Simple\Psr6Cache
        arguments: ['@cache.pool1']

    cache.simple.pool2
        class: Symfony\Component\Cache\Simple\Psr6Cache
        arguments: ['@cache.pool2']

This is quite cumbersome as we have alot of pools. It would be nice if the framework bundle provides a way to use SimpleCache directly. Maybe something like the following would create PSR-16 caches instead:

framework:
    cache:
        pools:
            cache.pool1:
                adapter: cache.adapter.redis
                simple: true
            cache.pool2:
                adapter: cache.adapter.redis
                simple: true

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