2014-09-18 115 views
4

我开始在我的项目(php-redis)上使用Redis。是Symfony2的项目,我发现:清除存储在Redis中的Doctrine缓存

https://github.com/snc/SncRedisBundle

我按照安装过程和我配置:

  • 有些客户不存-SQL数据和缓存
  • 会话存储
  • 学说metada,结果和查询缓存

我crea在一个捆绑中的新实体,我失败了,因为我在yml创建它,我有所有其他的注释系统,所以我删除yml格式并创建注释。

我在注解类(例如更改表名)上进行的每个更改都不会影响架构或数据库,即使我重新创建数据库或尝试执行缓存:使用所有选项清除。

如果我只是评论redis原则配置行,它的作品,我可以看到架构上的变化。

我也许忘了一些东西,或者我真的找不到如何清理该教条redis缓存。

¿我必须手动清理redis客户端上用于缓存的任何位置?

下面是配置:

#Snc Redis Bundle 
snc_redis: 
    clients: 
    d2a: 
     type: phpredis 
     alias: d2a 
     dsn: redis://localhost/1 
    cache: 
     type: phpredis 
     alias: cache 
     dsn: redis://localhost 
     logging: true 
    session: 
    client: d2a 
    prefix: redis_session 
    doctrine: 
    metadata_cache: 
     client: cache 
     entity_manager: default   # the name of your entity_manager connection 
     document_manager: default  # the name of your document_manager connection 
    result_cache: 
     client: cache 
     entity_manager: [default, read] # you may specify multiple entity_managers 
    query_cache: 
     client: cache 
     entity_manager: default 
+0

你试过完全删除实体,并与注释,而不是阳明重建呢? – andy 2014-09-18 21:17:14

+0

是的,我试过了,是对我的问题的解释 – ruudy 2014-09-20 08:34:43

回答

1

最简单的方法,但不是最好的一个是冲洗Redis的教义缓存分贝。运行

php app/console redis:flushdb --client=cache 

(未测试!)另一种方式是建立教义元数据缓存在教义配置http://symfony.com/doc/current/reference/configuration/doctrine.html#caching-drivers

orm: 
    entity_managers: 
     # A collection of different named entity managers (e.g. some_em, another_em) 
     some_em: 
      metadata_cache_driver: 
       type:     array # Required 
       host:     ~ 
       port:     ~ 
       instance_class:  ~ 
       class:    ~