3

配置.yml:

cache:
    app: cache.adapter.doctrine
    system: cache.adapter.doctrine
    default_doctrine_provider: ~
    default_psr6_provider: ~
    default_redis_provider: "redis://localhost:6379"

Symfony 3.1 支持学说缓存,但您没有足够的文档。

缓存组件:http
://symfony.com/doc/current/components/cache.html 支持的驱动器:http
: //symfony.com/doc/current/components/cache/cache_pools.html Symfony 集成:http://symfony .com/blog/new-in-symfony-3-1-cache-component

default_doctrine_provider:?作为提供者我应该输入什么

4

2 回答 2

2

您可以传递给default_doctrine_providerRedis 连接 DSN(例如“redis://127.0.0.1:6379”)或实现的服务的 IDSymfony\Component\Cache\Adapter\AdapterInterface

您可以在这里查看已经实现的适配器

于 2016-08-16T15:59:21.290 回答
0

提供者基本上是doctrine_cache您配置的原始提供者。假设您使用DoctrineCacheBundle并且您的提供者名称my_apc_cache意味着容器具有以下服务:

$myCache = $this->container->get('doctrine_cache.providers.my_apc_cache');

你也可以定义一个别名,这样就更容易了。

看看这个例子:https ://symfony.com/doc/current/bundles/DoctrineCacheBundle/usage.html#service-aliases

于 2016-09-29T09:24:09.550 回答