How to set the cache driver of Symfony4's Annotations to Redis?

I"m learning that the default cache driver for Symfony,Annotation is \ Symfony\ Component\ Cache\ Adapter\ PhpArrayAdapter , and now I want to set it to \ Symfony\ Component\ Cache\ Adapter , but I don"t know how to modify it in the yaml configuration file.

official documentation describes this section as follows:

needs to create a "service id" and refer to a class that implements the Doctrine Cache interface.

how should "service id" be established here? Or how to write a configuration file?

May.18,2022

in the config/services.yaml file, under the services item, add the following service id. I use the snc_redis component here, and you can replace it with your own implementation to obtain Redis

.
app.doctrine_cache:
    class: Doctrine\Common\Cache\RedisCache
    calls:
        - ["setRedis", ["@snc_redis.cache"]]
        - ["setNamespace", ["DoctrineRedisCache"]]
Menu