Browse Source

Merge pull request #11612 from cakephp/dereuromark-patch-1

Fix cache as dependency for ORM
Mark Story 8 years ago
parent
commit
83815ac491
3 changed files with 23 additions and 5 deletions
  1. 2 2
      src/Database/composer.json
  2. 3 2
      src/Datasource/composer.json
  3. 18 1
      src/ORM/README.md

+ 2 - 2
src/Database/composer.json

@@ -25,12 +25,12 @@
     },
     "require": {
         "php": ">=5.6.0",
+        "cakephp/cache": "^3.0.0",
         "cakephp/core": "^3.0.0",
         "cakephp/datasource": "^3.0.0"
     },
     "suggest": {
-        "cakephp/log": "Require this if you want to use the built-in query logger",
-        "cakephp/cache": "Require this if you decide to use the schema caching feature"
+        "cakephp/log": "Require this if you want to use the built-in query logger"
     },
     "autoload": {
         "psr-4": {

+ 3 - 2
src/Datasource/composer.json

@@ -28,8 +28,9 @@
         "cakephp/core": "^3.0.0"
     },
     "suggest": {
-        "cakephp/utility": "Require this if you decide to use EntityTrait",
-        "cakephp/collection": "Require this if you decide to use ResultSetInterface"
+        "cakephp/utility": "If you decide to use EntityTrait.",
+        "cakephp/collection": "If you decide to use ResultSetInterface.",
+        "cakephp/cache": "If you decide to use Query caching."
     },
     "autoload": {
         "psr-4": {

+ 18 - 1
src/ORM/README.md

@@ -32,7 +32,8 @@ ConnectionManager::setConfig('default', [
 	'database' => 'test',
 	'username' => 'root',
 	'password' => 'secret',
-	'cacheMetadata' => false // If set to `true` you need to install the optional "cakephp/cache" package.
+	'cacheMetadata' => true,
+	'quoteIdentifiers' => false,
 ]);
 ```
 
@@ -114,6 +115,22 @@ $article = $articles->get(2);
 $articles->delete($article);
 ```
 
+## Meta Data Cache
+
+It is recommended to enable meta data cache for production systems to avoid performance issues.
+For e.g. file system strategy your bootstrap file could look like this:
+```php
+use Cake\Cache\Engine\FileEngine;
+
+$cacheConfig = [
+   'className' => FileEngine::class,
+   'duration' => '+1 year',
+   'serialize' => true,
+   'prefix'    => 'orm_',
+],
+Cache::setConfig('_cake_model_', $cacheConfig);
+```
+
 ## Additional Documentation
 
 Consult [the CakePHP ORM documentation](https://book.cakephp.org/3.0/en/orm.html)