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:
committed by
Florent Vilmart
parent
801308d9b7
commit
b347bff641
@@ -8,13 +8,16 @@ import defaults from '../defaults';
|
||||
export default class SchemaCache {
|
||||
cache: Object;
|
||||
|
||||
constructor(cacheController, ttl = defaults.schemaCacheTTL) {
|
||||
constructor(cacheController, ttl = defaults.schemaCacheTTL, randomizePrefix = false) {
|
||||
this.ttl = ttl;
|
||||
if (typeof ttl == 'string') {
|
||||
this.ttl = parseInt(ttl);
|
||||
}
|
||||
this.cache = cacheController;
|
||||
this.prefix = SCHEMA_CACHE_PREFIX+randomString(20);
|
||||
this.prefix = SCHEMA_CACHE_PREFIX;
|
||||
if (!randomizePrefix) {
|
||||
this.prefix += randomString(20);
|
||||
}
|
||||
}
|
||||
|
||||
put(key, value) {
|
||||
|
||||
Reference in New Issue
Block a user