如何在 Symfony 5.2 中禁用缓存?

kim*_*mjo 0 symfony

如何在 Symfony 5.2 中完全禁用缓存?

我使用 PHP 配置文件 (services.php) 而不是yaml 文件。在文档中,我找不到任何匹配的内容。

Arl*_*Hix 8

尝试配置两个默认始终启用的池以使用Symfony\Component\Cache\Adapter\NullAdapter

framework:
    cache:
        app: cache.adapter.null
        system: cache.adapter.null

services:
    cache.adapter.null:
        class: Symfony\Component\Cache\Adapter\NullAdapter
        arguments: [~] # small trick to avoid arguments errors on compile-time.
Run Code Online (Sandbox Code Playgroud)

https://symfony.com/doc/current/cache.html#configuring-cache-with-frameworkbundle /sf/answers/3282910921/