I start using Redis on me project (php-redis). Is a Symfony2 project and i found the:
我开始在我的项目(php-redis)上使用Redis。是一个Symfony2项目,我发现:
https://github.com/snc/SncRedisBundle
I follow the installation process and i configured:
我按照安装过程配置:
- Some clients to store no-sql data and cache
- Sessions storage
- Doctrine metada, result and query cache
一些客户端存储no-sql数据和缓存
Doctrine metada,结果和查询缓存
I create a new entity in a bundle and i fail because i create it at yml and i have all others with annotation system, so i delete yml format and create the annotation.
我在一个包中创建了一个新的实体,但是我失败了,因为我在yml创建了它,并且我有其他所有的注释系统,所以我删除了yml格式并创建了注释。
Every change i make on the annotation class (change the table name for example), is not affecting the schema or the database, even i recreate the database or try to execute cache:clear with all the options.
我在注释类上做的每一个更改(例如更改表名)都不会影响架构或数据库,即使我重新创建数据库或尝试执行缓存:清除所有选项。
If i just comment the redis doctrine configuration lines, it works and i can see the changes on the schema.
如果我只是评论redis doctrine配置行,它可以工作,我可以看到架构上的更改。
Im maybe forgetting something, or i cant really find how to clean that doctrine redis cache.
我可能会遗忘一些东西,或者我真的无法找到如何清理该教条的redis缓存。
¿I have to manually clean any position on the redis client use for caching?
¿我必须手动清理redis客户端用于缓存的任何位置?
Here is the configuration:
这是配置:
#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
1 个解决方案
#1
1
The easiest way but not the best one is to flush redis db with doctrine cache. Run
最简单的方法,但不是最好的方法是使用doctrine缓存刷新redis数据库。跑
php app/console redis:flushdb --client=cache
(Not tested!) Another way is to setup doctrine metadata cache in doctrine config http://symfony.com/doc/current/reference/configuration/doctrine.html#caching-drivers
(未经过测试!)另一种方法是在doctrine config中设置doctrine元数据缓存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: ~
#1
1
The easiest way but not the best one is to flush redis db with doctrine cache. Run
最简单的方法,但不是最好的方法是使用doctrine缓存刷新redis数据库。跑
php app/console redis:flushdb --client=cache
(Not tested!) Another way is to setup doctrine metadata cache in doctrine config http://symfony.com/doc/current/reference/configuration/doctrine.html#caching-drivers
(未经过测试!)另一种方法是在doctrine config中设置doctrine元数据缓存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: ~