Adds schema caching capabilities (5s by default) (#2286)

* Adds schema caching capabilities (off by default)

* Use InMemoryCacheAdapter

* Uses proper adapter to generate a cache

* Fix bugs when running disabled cache

* nits

* nits

* Use options object instead of boolean

* Imrpove concurrency of loadSchema

* Adds testing with SCHEMA_CACHE_ON

* Use CacheController instead of generator

- Makes caching SchemaCache use a generated prefix
- Makes clearing the SchemaCache clear only the cached schema keys
- Enable cache by default (ttl 5s)
This commit is contained in:
Florent Vilmart
2016-07-23 06:23:59 +02:00
committed by Drew
parent 66c4b98b55
commit 09bd9e3b2c
14 changed files with 205 additions and 47 deletions

View File

@@ -4,7 +4,7 @@ var Config = require('../src/Config');
var SchemaController = require('../src/Controllers/SchemaController');
var dd = require('deep-diff');
var config = new Config('test');
var config;
var hasAllPODobject = () => {
var obj = new Parse.Object('HasAllPOD');
@@ -20,6 +20,10 @@ var hasAllPODobject = () => {
};
describe('SchemaController', () => {
beforeEach(() => {
config = new Config('test');
});
it('can validate one object', (done) => {
config.database.loadSchema().then((schema) => {
return schema.validateObject('TestObject', {a: 1, b: 'yo', c: false});