是否可以使用MongoDB在Symfony 2中存储会话?如果是这样,怎么样?
仅仅因为我认为问题没有得到真正回答.在Symfony 2.1中,现在可以使用包含在HttpFoundation组件中的MongoDbSessionHandler在MongoDB中存储会话数据.
config.yml的主要配置如下:
session.handler.mongo: class: Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler arguments: [@mongo, %mongo.session.options%] mongo.connection: class: MongoDoctrine\MongoDB\Connection factory_service: doctrine.odm.mongodb.document_manager factory_method: getConnection calls: - [initialize, []] mongo: class: Mongo factory_service: mongo.connection factory_method: getMongo mongo.session.options: database: app_session collection: session framework: session: handler_id: session.handler.mongo
点击此处了解更多信息:http://blog.servergrove.com/2012/11/05/storing-sessions-in-mongodb-with-symfony2/