symfonyorocommerce

How to properly enable second level cache in Orocommerce


I wrote the following configuration in config.yml, but I'm not sure if this is the right thing to do:

doctrine:
orm:
    entity_managers:
        default:
            metadata_cache_driver:
                type: service
                id:   doctrine.metadata.cache
            query_cache_driver:
                type: service
                id: doctrine.query.cache
            second_level_cache:
                region_cache_driver:
                    type: service
                    id: snc_second_level_cache
                enabled: true
                region_lifetime: 600
            result_cache_driver:
                type: service
                id: doctrine.result.cache

service configuration:

    snc_second_level_cache:
        class: '%snc_redis.doctrine_cache_predis.class%'
        arguments:
            - '@snc_redis.doctrine'

Solution

  • The Oro team has investigated this feature, and for now, we found that it brings more issues than benefits, so the application doesn't support it out of the box, and enabling it just with the configuration does not affect anything.

    However, if you want to enable it for some custom entities, the configuration seems correct. Just pay attention that there are multiple entity managers in ORO, not only the default one.