44import graphql .kickstart .execution .GraphQLObjectMapper ;
55import graphql .kickstart .execution .GraphQLQueryInvoker ;
66import graphql .kickstart .execution .context .ContextSetting ;
7+ import graphql .kickstart .servlet .cache .GraphQLResponseCacheManager ;
78import graphql .kickstart .servlet .config .DefaultGraphQLSchemaServletProvider ;
89import graphql .kickstart .servlet .config .GraphQLSchemaServletProvider ;
910import graphql .kickstart .servlet .context .GraphQLServletContextBuilder ;
@@ -36,12 +37,13 @@ public class GraphQLConfiguration {
3637 @ Getter
3738 private final long asyncTimeout ;
3839 private final ContextSetting contextSetting ;
40+ private final GraphQLResponseCacheManager responseCacheManager ;
3941
4042 private GraphQLConfiguration (GraphQLInvocationInputFactory invocationInputFactory ,
4143 GraphQLQueryInvoker queryInvoker ,
4244 GraphQLObjectMapper objectMapper , List <GraphQLServletListener > listeners , boolean asyncServletModeEnabled ,
4345 Executor asyncExecutor , long subscriptionTimeout , long asyncTimeout , ContextSetting contextSetting ,
44- Supplier <BatchInputPreProcessor > batchInputPreProcessor ) {
46+ Supplier <BatchInputPreProcessor > batchInputPreProcessor , GraphQLResponseCacheManager responseCacheManager ) {
4547 this .invocationInputFactory = invocationInputFactory ;
4648 this .queryInvoker = queryInvoker ;
4749 this .graphQLInvoker = queryInvoker .toGraphQLInvoker ();
@@ -53,6 +55,7 @@ private GraphQLConfiguration(GraphQLInvocationInputFactory invocationInputFactor
5355 this .asyncTimeout = asyncTimeout ;
5456 this .contextSetting = contextSetting ;
5557 this .batchInputPreProcessor = batchInputPreProcessor ;
58+ this .responseCacheManager = responseCacheManager ;
5659 }
5760
5861 public static GraphQLConfiguration .Builder with (GraphQLSchema schema ) {
@@ -113,6 +116,10 @@ public BatchInputPreProcessor getBatchInputPreProcessor() {
113116 return batchInputPreProcessor .get ();
114117 }
115118
119+ public GraphQLResponseCacheManager getResponseCacheManager () {
120+ return responseCacheManager ;
121+ }
122+
116123 public static class Builder {
117124
118125 private GraphQLInvocationInputFactory .Builder invocationInputFactoryBuilder ;
@@ -126,6 +133,7 @@ public static class Builder {
126133 private long asyncTimeout = 30 ;
127134 private ContextSetting contextSetting = ContextSetting .PER_QUERY_WITH_INSTRUMENTATION ;
128135 private Supplier <BatchInputPreProcessor > batchInputPreProcessorSupplier = NoOpBatchInputPreProcessor ::new ;
136+ private GraphQLResponseCacheManager responseCacheManager ;
129137
130138 private Builder (GraphQLInvocationInputFactory .Builder invocationInputFactoryBuilder ) {
131139 this .invocationInputFactoryBuilder = invocationInputFactoryBuilder ;
@@ -209,6 +217,11 @@ public Builder with(Supplier<BatchInputPreProcessor> batchInputPreProcessor) {
209217 return this ;
210218 }
211219
220+ public Builder with (GraphQLResponseCacheManager responseCache ) {
221+ this .responseCacheManager = responseCache ;
222+ return this ;
223+ }
224+
212225 public GraphQLConfiguration build () {
213226 return new GraphQLConfiguration (
214227 this .invocationInputFactory != null ? this .invocationInputFactory : invocationInputFactoryBuilder .build (),
@@ -220,7 +233,8 @@ public GraphQLConfiguration build() {
220233 subscriptionTimeout ,
221234 asyncTimeout ,
222235 contextSetting ,
223- batchInputPreProcessorSupplier
236+ batchInputPreProcessorSupplier ,
237+ responseCacheManager
224238 );
225239 }
226240
0 commit comments