Skip to content

Configure a custom marshaller in cache framework bundle per cache pool #59366

Open
@mvanduijker

Description

@mvanduijker

Description

I couldn't figure out a way to configure a custom marshaller service in per cache pool configuration in the framework bundle. So I can configure an encrypting or compressing marshaller per cache pool.

It is documented how to overwrite the marshaller service but then that's used for all cache pools.

If it's already possible, may we should improve the documentation how to do this.

Example

# config/packages/cache.yaml

framework:
    cache:
        pools:
            local_cache:
                adapter: apcu
                marshaller: '@app.cache.compressing_marshaller'

            token_cache:
                adapter: cache.adapter.redis
                marshaller: '@app.cache.encrypting_marshaller'

services:
    app.cache.encrypting_marshaller:
        class: Symfony\Component\Cache\Marshaller\SodiumMarshaller
        arguments:
            - ['%env(base64:CACHE_DECRYPTION_KEY)%']
            # use multiple keys in order to rotate them
            #- ['%env(base64:CACHE_DECRYPTION_KEY)%', '%env(base64:OLD_CACHE_DECRYPTION_KEY)%']
            - '@cache.default_marshaller'
      
    app.cache.compressing_marshaller:
        class: Symfony\Component\Cache\Marshaller\DeflateMarshaller
        arguments:
            - '@cache.default_marshaller'

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy