Add option to re-use schema cache between requests (#2979)

* Add option to reuse database controller between requests. Clear schema cache when deleting everything

* Add test

* Rename setting to persistSchemaCache to more accurately reflect effect

* Repurpose option to determine whether to randomize cache prefix. Restore Config.js controller creation. Add tests

* Fix bug with missing parameter passed to to SchemaCache

* Renaming and formatting

* Fix property name typo

* Rename option to avoid double negative and still be falsey by default. Style fix
This commit is contained in:
Steven Shipton
2016-11-02 23:05:23 +00:00
committed by Florent Vilmart
parent 801308d9b7
commit b347bff641
7 changed files with 128 additions and 34 deletions

View File

@@ -139,6 +139,7 @@ class ParseServer {
expireInactiveSessions = defaults.expireInactiveSessions,
revokeSessionOnPasswordReset = defaults.revokeSessionOnPasswordReset,
schemaCacheTTL = defaults.schemaCacheTTL, // cache for 5s
enableSingleSchemaCache = false,
__indexBuildCompletionCallbackForTests = () => {},
}) {
// Initialize the node client SDK automatically
@@ -181,7 +182,7 @@ class ParseServer {
const analyticsController = new AnalyticsController(analyticsControllerAdapter);
const liveQueryController = new LiveQueryController(liveQuery);
const databaseController = new DatabaseController(databaseAdapter, new SchemaCache(cacheController, schemaCacheTTL));
const databaseController = new DatabaseController(databaseAdapter, new SchemaCache(cacheController, schemaCacheTTL, enableSingleSchemaCache));
const hooksController = new HooksController(appId, databaseController, webhookKey);
const dbInitPromise = databaseController.performInitizalization();
@@ -221,7 +222,8 @@ class ParseServer {
jsonLogs,
revokeSessionOnPasswordReset,
databaseController,
schemaCacheTTL
schemaCacheTTL,
enableSingleSchemaCache
});
// To maintain compatibility. TODO: Remove in some version that breaks backwards compatability