我已经从Memcached迁移到了Redis。起初我使用的是PECL Redis 3.1.3,一切正常。更新到3.1.5后,我开始收到错误:
未捕获的PHP异常Symfony \ Component \ Debug \ Exception \ FatalThrowableError:“类型错误:传递给Symfony \ Component \ Validator \ Mapping \ Factory \ LazyLoadingMetadataFactory :: mergeConstraints()的参数1必须是Symfony \ Component \ Validator \ Mapping \的实例ClassMetadata,给定的字符串,在/ var / www / acme / www上的/var/www/acme/www/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php中调用/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php第120行
我看了,并且redis更改日志,并没有找到任何线索,两个版本更新后可能出错。
我的config.yml(只有缓存/ redis的东西):
framework:
validation:
cache: validator.mapping.cache.redis
serializer:
cache: serializer.mapping.cache.redis
session:
handler_id: session.handler.redis
doctrine:
orm:
auto_mapping: true
metadata_cache_driver:
type: redis
host: "%redis.ip%"
port: "%redis.port%"
instance_class: Redis
class: RedisCache
query_cache_driver:
type: redis
host: "%redis.ip%"
port: "%redis.port%"
instance_class: Redis
class: RedisCache
result_cache_driver:
type: redis
host: "%redis.ip%"
port: "%redis.port%"
instance_class: Redis
class: RedisCache
services:
serializer.mapping.cache.redis:
class: Doctrine\Common\Cache\RedisCache
validator.mapping.cache.redis:
class: Symfony\Component\Validator\Mapping\Cache\DoctrineCache
arguments: ['@doctrine.cache.redis']
redis:
class: Redis
calls:
- [ connect, [ '%redis.ip%', '%redis.port%' ]]
doctrine.cache.redis:
class: Doctrine\Common\Cache\RedisCache
calls:
- [setRedis, ["@redis"]]
session.handler.redis:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler
serializer.mapping.cache.memcached:
class: Doctrine\Common\Cache\MemcachedCache
doctrine_cache:
providers:
redis_cache:
redis:
connection_id: redis
我的symfony版本是2.8.31。有什么建议?
冲洗redis解决了问题..傻
redis-cli flushall