You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename property for RESTDataSource from requestCacheEnabled to memoizeGetRequests
From the initial PR, the name of the new property was a little confusing since there are actually
two caches, but what is being cached is the response data in the end.
Original PR #3
Back-port of apollographql/apollo-server#6834
Copy file name to clipboardExpand all lines: README.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,19 +65,20 @@ class MoviesAPI extends RESTDataSource {
65
65
}
66
66
```
67
67
68
-
##### `requestCacheEnabled`
68
+
##### `memoizeGetRequests`
69
69
By default, `RESTDataSource` caches all outgoing GET **requests** in a separate memoized cache from the regular response cache. It makes the assumption that all responses from HTTP GET calls are cacheable by their URL.
70
70
If a request is made with the same cache key (URL by default) but with an HTTP method other than GET, the cached request is then cleared.
71
71
72
-
If you would like to disable the GET request cache, set the `requestCacheEnabled` property to `false`. You might want to do this if your API is not actually cacheable or your data changes over time.
72
+
If you would like to disable the GET request cache, set the `memoizeGetRequests` property to `false`. You might want to do this if your API is not actually cacheable or your data changes over time.
73
73
74
-
```js title="requestCacheEnabled.js"
74
+
```js title="memoizeGetRequests.js"
75
75
classMoviesAPIextendsRESTDataSource {
76
76
constructor() {
77
77
super();
78
78
// Defaults to true
79
-
this.requestCacheEnabled=false;
79
+
this.memoizeGetRequests=false;
80
80
}
81
+
81
82
// Outgoing requests are never cached, however the response cache is still enabled
82
83
asyncgetMovie(id) {
83
84
returnthis.get(
@@ -102,9 +103,9 @@ Allows setting the `CacheOptions` to be used for each request/response in the HT
0 commit comments