Sonata 块 http 缓存处理程序 sonata.cache.noop 未定义

Sonata block http cache handler sonata.cache.noop not defined

我正在尝试设置 sonata 块缓存,但是当我设置 http_cache 处理程序时,即使服务似乎存在,我也会遇到异常。

我当前的测试设置如下

sonata_cache:
    caches:
        predis:
            servers:
                - {host: %redis_host%, port: %redis_port%, database: 2}
        apc:
            token:  %secret%   # token used to clear the related cache
            prefix: %domain%     # prefix to ensure there is no clash between instances
#            servers:
#                - { domain: %domain%, ip: 127.0.0.1, port: 80 }
            timeout:
                RCV: { sec: 5, usec: 0 }
                SND: { sec: 5, usec: 0 }

sonata_block:
    http_cache:
#        handler: sonata.cache.noop
        listener: true

我可以看到我在 sonata_cache.caches

上启用的多项服务
$ app/console debug:container sonata.cache.noop
[container] Information for service sonata.cache.noop
Service Id       sonata.cache.noop
Class            Sonata\Cache\Adapter\Cache\NoopCache
Tags
    - sonata.cache                   ()
[...]

如果我将 sonata_block 设置更改为:

sonata_block:
    http_cache:
        handler: sonata.cache.noop
        listener: true

我得到以下异常

InvalidArgumentException in ContainerBuilder.php line 796 "The service definition "sonata.cache.noop" does not exist."

有人遇到过类似的问题吗?

尝试替换:

handler: sonata.cache.noop

至:

handler: sonata.block.cache.handler.noop