Caching parse and validate by default by bbakerman · Pull Request #4121 · graphql-java/graphql-java
I have manually tested a consumer where Caffiene is and is not on the classpath
TypeDefinitionRegistry registry = new SchemaParser().parse("type Query { f : String }");
RuntimeWiring runtimeWiring = RuntimeWiring.MOCKED_WIRING;
GraphQLSchema graphQLSchema = new SchemaGenerator().makeExecutableSchema(registry, runtimeWiring);
GraphQL graphQL = GraphQL.newGraphQL(graphQLSchema).build();
for (int i = 1; i <= 5; i++) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
ExecutionInput ei = ExecutionInput.newExecutionInput().query("query q { f }").root(Map.of("f", "F")).build();
ExecutionResult er = graphQL.execute(ei);
System.out.println("i" + i + "data : " + er.getData() + " : errors : " + er.getErrors());
}
dependencies {
implementation("com.graphql-java:graphql-java:0.0.0-caching-query-parsing-and-validation-SNAPSHOT")
implementation("com.github.ben-manes.caffeine:caffeine:3.1.8")
}
or
dependencies {
implementation("com.graphql-java:graphql-java:0.0.0-caching-query-parsing-and-validation-SNAPSHOT")
}
I can confirm the Caffeine detection code works as expected and it does NOT load any Caffeine code unless its present and hence it works as a No Op when caffeine is NOT present but caches when it is present