E57E Deprecate Apollo Cache Control · graphql-java/graphql-java@d94bdf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit d94bdf4

Browse files
committed
Deprecate Apollo Cache Control
1 parent 6d87767 commit d94bdf4

File tree

7 files changed

+42
-0
lines changed

7 files changed

+42
-0
lines changed

src/main/java/graphql/ExecutionInput.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ public DataLoaderRegistry getDataLoaderRegistry() {
120120

121121
/**
122122
* @return the cache control helper associated with this execution
123+
*
124+
* @deprecated - Apollo has deprecated the Cache Control specification
123125
*/
126+
@Deprecated
124127
public CacheControl getCacheControl() {
125128
return cacheControl;
126129
}
@@ -390,6 +393,7 @@ public Builder dataLoaderRegistry(DataLoaderRegistry dataLoaderRegistry) {
390393
return this;
391394
}
392395

396+
@Deprecated
393397
public Builder cacheControl(CacheControl cacheControl) {
394398
this.cacheControl = assertNotNull(cacheControl);
395399
return this;

src/main/java/graphql/cachecontrol/CacheControl.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
import static graphql.collect.ImmutableKit.map;
1818

1919
/**
20+
* Apollo has deprecated their Cache Control specification https://github.com/apollographql/apollo-cache-control
21+
* This has been deprecated/removed from Apollo some time.
22+
* Apollo now provides an alternative approach via the @cacheControl directive https://www.apollographql.com/docs/apollo-server/performance/caching/
23+
* We are deprecating CacheControl inside graphql-java and this will be deleted in a future release.
24+
*
2025
* This class implements the graphql Cache Control specification as outlined in https://github.com/apollographql/apollo-cache-control
2126
* <p>
2227
* To best use this class you need to pass a CacheControl object to each {@link graphql.schema.DataFetcher} and have them decide on
@@ -28,6 +33,7 @@
2833
* Then at the end of the query you would call {@link #addTo(graphql.ExecutionResult)} to record the cache control hints into the {@link graphql.ExecutionResult}
2934
* extensions map as per the specification.
3035
*/
36+
@Deprecated
3137
@PublicApi
3238
public class CacheControl {
3339

@@ -81,7 +87,10 @@ private CacheControl() {
8187
* @param maxAge the caching time in seconds
8288
* @param scope the scope of the cache control hint
8389
* @return this object builder style
90+
*
91+
* @deprecated - Apollo has deprecated the Cache Control specification
8492
*/
93+
@Deprecated
8594
public CacheControl hint(ResultPath path, Integer maxAge, Scope scope) {
8695
assertNotNull(path);
8796
assertNotNull(scope);
@@ -95,7 +104,10 @@ public CacheControl hint(ResultPath path, Integer maxAge, Scope scope) {
95104
* @param path the path to the field that has the cache control hint
96105
* @param scope the scope of the cache control hint
97106
* @return this object builder style
107+
*
108+
* @deprecated - Apollo has deprecated the Cache Control specification
98109
*/
110+
@Deprecated
99111
public CacheControl hint(ResultPath path, Scope scope) {
100112
return hint(path, null, scope);
101113
}
@@ -106,7 +118,10 @@ public CacheControl hint(ResultPath path, Scope scope) {
106118
* @param path the path to the field that has the cache control hint
107119
* @param maxAge the caching time in seconds
108120
* @return this object builder style
121+
*
122+
* @deprecated - Apollo has deprecated the Cache Control specification
109123
*/
124+
@Deprecated
110125
public CacheControl hint(ResultPath path, Integer maxAge) {
111126
return hint(path, maxAge, Scope.PUBLIC);
112127
}
@@ -118,7 +133,10 @@ public CacheControl hint(ResultPath path, Integer maxAge) {
118133
* @param maxAge the caching time in seconds
119134
* @param scope the scope of the cache control hint
120135
* @return this object builder style
136+
*
137+
* @deprecated - Apollo has deprecated the Cache Control specification
121138
*/
139+
@Deprecated
122140
public CacheControl hint(DataFetchingEnvironment dataFetchingEnvironment, Integer maxAge, Scope scope) {
123141
assertNotNull(dataFetchingEnvironment);
124142
assertNotNull(scope);
@@ -132,7 +150,10 @@ public CacheControl hint(DataFetchingEnvironment dataFetchingEnvironment, Intege
132150
* @param dataFetchingEnvironment the path to the field that has the cache control hint
133151
* @param maxAge the caching time in seconds
134152
* @return this object builder style
153+
*
154+
* @deprecated - Apollo has deprecated the Cache Control specification
135155
*/
156+
@Deprecated
136157
public CacheControl hint(DataFetchingEnvironment dataFetchingEnvironment, Integer maxAge) {
137158
hint(dataFetchingEnvironment, maxAge, Scope.PUBLIC);
138159
return this;
@@ -144,7 +165,10 @@ public CacheControl hint(DataFetchingEnvironment dataFetchingEnvironment, Intege
144165
* @param dataFetchingEnvironment the path to the field that has the cache control hint
145166
* @param scope the scope of the cache control hint
146167
* @return this object builder style
168+
*
169+
* @deprecated - Apollo has deprecated the Cache Control specification
147170
*/
171+
@Deprecated
148172
public CacheControl hint(DataFetchingEnvironment dataFetchingEnvironment, Scope scope) {
149173
return hint(dataFetchingEnvironment, null, scope);
150174
}
@@ -153,7 +177,10 @@ public CacheControl hint(DataFetchingEnvironment dataFetchingEnvironment, Scope
153177
* Creates a new CacheControl object that can be used to trick caching hints
154178
*
155179
* @return the new object
180+
*
181+
* @deprecated - Apollo has deprecated the Cache Control specification
156182
*/
183+
@Deprecated
157184
public static CacheControl newCacheControl() {
158185
return new CacheControl();
159186
}
@@ -164,7 +191,10 @@ public static CacheControl newCacheControl() {
164191
*
165192
* @param executionResult the starting execution result object
166193
* @return a new execution result with the hints in the extensions map.
194+
*
195+
* @deprecated - Apollo has deprecated the Cache Control specification
167196
*/
197+
@Deprecated
168198
public ExecutionResult addTo(ExecutionResult executionResult) {
169199
return ExecutionResultImpl.newExecutionResult()
170200
.from(executionResult)

src/main/java/graphql/execution/ExecutionContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public DataLoaderRegistry getDataLoaderRegistry() {
163163
return dataLoaderRegistry;
164164
}
165165

166+
@Deprecated
166167
public CacheControl getCacheControl() {
167168
return cacheControl;
168169
}

src/main/java/graphql/execution/ExecutionContextBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ public ExecutionContextBuilder dataLoaderRegistry(DataLoaderRegistry dataLoaderR
187187
return this;
188188
}
189189

190+
@Deprecated
190191
public ExecutionContextBuilder cacheControl(CacheControl cacheControl) {
191192
this.cacheControl = cacheControl;
192193
return this;

src/main/java/graphql/schema/DataFetchingEnvironment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ public interface DataFetchingEnvironment extends IntrospectionDataFetchingEnviro
238238

239239
/**
240240
* @return the current {@link CacheControl} instance used to add cache hints to the response
241+
*
242+
* @deprecated - Apollo has deprecated the Cache Control specification
241243
*/
244+
@Deprecated
242245
CacheControl getCacheControl();
243246

244247
/**

src/main/java/graphql/schema/DataFetchingEnvironmentImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ public DataLoaderRegistry getDataLoaderRegistry() {
218218
}
219219

220220
@Override
221+
@Deprecated
221222
public CacheControl getCacheControl() {
222223
return cacheControl;
223224
}
@@ -391,6 +392,7 @@ public Builder dataLoaderRegistry(DataLoaderRegistry dataLoaderRegistry) {
391392
return this;
392393
}
393394

395+
@Deprecated
394396
public Builder cacheControl(CacheControl cacheControl) {
395397
this.cacheControl = cacheControl;
396398
return this;

src/main/java/graphql/schema/DelegatingDataFetchingEnvironment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public Locale getLocale() {
162162
}
163163

164164
@Override
165+
@Deprecated
165166
public CacheControl getCacheControl() {
166167
return delegateEnvironment.getCacheControl();
167168
}

0 commit comments

Comments
 (0)
0