@@ -70,7 +70,7 @@ orm.connect("mysql://username:password@host/database", function (err, db) {
7070 });
7171
7272 // add the table to the database
73- db .sync (function (err ) {
73+ db .sync (function (err ) {
7474 if (err) throw err;
7575
7676 // add a row to the person table
@@ -90,7 +90,7 @@ orm.connect("mysql://username:password@host/database", function (err, db) {
9090 // err.msg = "under-age";
9191 });
9292 });
93-
93+
9494 });
9595 });
9696});
@@ -278,9 +278,9 @@ var Person = db.define("person", {
278278
279279Other options:
280280
281- - ` cache ` : (default: ` true ` ) Set it to ` false ` to disable Instance cache ([ Singletons] ( #singleton ) ) or set a timeout value (in seconds);
282- - ` autoSave ` : (default: ` false ` ) Set it to ` true ` to save an Instance right after changing any property;
283- - ` autoFetch ` : (default: ` false ` ) Set it to ` true ` to fetch associations when fetching an instance from the database;
281+ - ` identityCache ` : (default: ` false ` ) Set it to ` true ` to enable identity cache ([ Singletons] ( #singleton ) ) or set a timeout value (in seconds);
282+ - ` autoSave ` : (default: ` false ` ) Set it to ` true ` to save an Instance right after changing any property;
283+ - ` autoFetch ` : (default: ` false ` ) Set it to ` true ` to fetch associations when fetching an instance from the database;
284284- ` autoFetchLimit ` : (default: ` 1 ` ) If ` autoFetch ` is enabled this defines how many hoops (associations of associations)
285285 you want it to automatically fetch.
286286
@@ -514,30 +514,32 @@ db.driver.execQuery(
514514)
515515```
516516
517- ### Caching & Integrity
517+ ### Identity pattern
518+
519+ You can use the identity pattern (turned off by default). If enabled, multiple different queries will result in the same result - you will
520+ get the same object. If you have other systems that can change your database or you need to call some manual SQL queries,
521+ you shouldn't use this feature. It is also know to cause some problems with complex
522+ autofetch relationships. Use at your own risk.
518523
519- Model instances are cached. If multiple different queries will result in the same result, you will
520- get the same object. If you have other systems that can change your database (or you're developing and need
521- to make some manual changes) you should remove this feature by disabling cache. This can be done when you're
522- defining the Model.
524+ It can be enabled/disabled per model:
523525
524526``` js
525527var Person = db .define (' person' , {
526- name : String
528+ name : String
527529}, {
528- cache : false
530+ identityCache : true
529531});
530532```
531533
532534and also globally:
533535
534536``` js
535537orm .connect (' ...' , function (err , db ) {
536- db .settings .set (' instance.cache ' , false );
538+ db .settings .set (' instance.identityCache ' , true );
537539});
538540```
539541
540- The cache can be configured to expire after a period of time by passing in a number instead of a
542+ The identity cache can be configured to expire after a period of time by passing in a number instead of a
541543boolean. The number will be considered the cache timeout in seconds (you can use floating point).
542544
543545** Note** : One exception about Caching is that it won't be used if an instance is not saved. For example, if
0 commit comments