MySQL提供一系列的storage engines,其中的memory storage engine是內存中的選項。Symfony2應用程序如何使用MySQL內存存儲引擎?
如何配置Symfony2應用程序告訴它告訴PDO告訴MySQL使用內存存儲引擎?
我想在兩種情況下這樣做。首先,我想爲測試環境做這樣的事情,以便在每個單元測試之前拆除並重建數據庫是一個更快的操作。其次,我想將它應用於數據相對短暫的Symfony2應用程序,因此當電源丟失時所有數據都丟失並不重要。
鑑於下面的示例應用程序配置(app/config/parameters.yml),我需要對要使用的內存存儲引擎進行哪些更改?
@Table(name="table_name",options={"engine"="memory"})
這將正常工作爲您瞬時產生的表:
parameters:
database_driver: pdo_mysql
database_host: localhost
database_port: null
database_name: example
database_user: user
database_password: password
你應該能夠在事後更改'ALTER TABLE'以更改'ENGINE'設置,對吧? – tadman