Clarify comments surrounding documentStore, which led to confusion.

The parsed/validated cache store is on by default.  While it could be disabled,
in theory, it cannot be disabled since its an internal property of the
request pipeline processor class.

See confusion here:

  https://github.com/withspectrum/spectrum/pull/4533#issuecomment-453446535
This commit is contained in:
Jesse Rosenberger 2019-01-15 16:29:06 +02:00
parent f33ae19f6d
commit 2652057c33
No known key found for this signature in database
GPG key ID: C0CCCF81AA6C08D8
2 changed files with 7 additions and 7 deletions

View file

@ -115,9 +115,9 @@ export class ApolloServerBase {
// the default version is specified in playground.ts
protected playgroundOptions?: PlaygroundRenderPageOptions;
// An optionally defined store that, when enabled (default), will store the
// parsed and validated versions of operations in-memory, allowing subsequent
// parse and validates on the same operation to be executed immediately.
// A store that, when enabled (default), will store the parsed and validated
// versions of operations in-memory, allowing subsequent parses/validates
// on the same operation to be executed immediately.
private documentStore?: InMemoryLRUCache<DocumentNode>;
// The constructor should be universal across all environments. All environment specific behavior should be set by adding or overriding methods

View file

@ -165,10 +165,10 @@ export async function processGraphQLRequest<TContext>(
});
try {
// If we're configured with a document store, we'll utilize the hash of the
// operation in order to lookup a previously parsed-and-validated operation
// from that. A failure to retrieve anything from the cache simply means
// we're guaranteed to do the parsing and validation ourselves.
// If we're configured with a document store (by default, we are), we'll
// utilize the operation's hash to lookup the AST from the previously
// parsed-and-validated operation. Failure to retrieve anything from the
// cache just means we're committed to doing the parsing and validation.
if (config.documentStore) {
requestContext.document = await config.documentStore.get(queryHash);
}