Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two unrelated small cache improvements #7241

Merged
merged 1 commit into from Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-eyes-chew.md
@@ -0,0 +1,5 @@
---
'@apollo/server-plugin-response-cache': minor
---

If the cache you provide to the `cache` option is created with `PrefixingKeyValueCache.cacheDangerouslyDoesNotNeedPrefixesForIsolation` (new in `@apollo/utils.keyvaluecache@2.1.0`), the `fqc:` prefix will not be added to cache keys.
5 changes: 5 additions & 0 deletions .changeset/selfish-buckets-mate.md
@@ -0,0 +1,5 @@
---
'@apollo/server': minor
---

If the cache you provide to the `persistedQueries.cache` option is created with `PrefixingKeyValueCache.cacheDangerouslyDoesNotNeedPrefixesForIsolation` (new in `@apollo/utils.keyvaluecache@2.1.0`), the `apq:` prefix will not be added to cache keys. Providing such a cache to `new ApolloServer()` throws an error.
5 changes: 5 additions & 0 deletions .changeset/sour-kiwis-eat.md
@@ -0,0 +1,5 @@
---
'@apollo/server': patch
---

For ease of upgrade from the recommended configuration of Apollo Server v3.9+, you can now pass `new ApolloServer({ cache: 'bounded' })`, which is equivalent to not providing the `cache` option (as a bounded cache is now the default in AS4).
2 changes: 1 addition & 1 deletion docs/source/api/apollo-server.mdx
Expand Up @@ -353,7 +353,7 @@ Controls whether to allow [Batching Queries](../workflow/requests/#batching) in

A [`KeyValueCache`](https://www.npmjs.com/package/@apollo/utils.keyvaluecache) which Apollo Server uses for several features, including APQs and full response caching. This cache is also available to Apollo Server's plugins.

The default cache is an [`InMemoryLRUCache`](https://www.npmjs.com/package/@apollo/utils.keyvaluecache) with a default size of roughly 30MiB.
The default cache is an [`InMemoryLRUCache`](https://www.npmjs.com/package/@apollo/utils.keyvaluecache) with a default size of roughly 30MiB. (For backwards-compatibility with Apollo Server 3, specifying `cache: 'bounded'` also selects this default bounded cache.)

To learn more about configuring Apollo Server's cache, see [Configuring cache backends](../performance/cache-backends).

Expand Down
207 changes: 136 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/gateway-interface/package.json
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@apollo/utils.fetcher": "^2.0.0",
"@apollo/utils.logger": "^2.0.0",
"@apollo/utils.keyvaluecache": "^2.0.1",
"@apollo/utils.keyvaluecache": "^2.1.0",
"@apollo/usage-reporting-protobuf": "^4.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-testsuite/package.json
Expand Up @@ -30,7 +30,7 @@
"@apollo/client": "^3.6.9",
"@apollo/server": "4.2.2",
"@apollo/server-plugin-landing-page-graphql-playground": "^4.0.0",
"@apollo/utils.keyvaluecache": "^2.0.1",
"@apollo/utils.keyvaluecache": "^2.1.0",
"@apollo/utils.createhash": "^2.0.0",
"@apollo/usage-reporting-protobuf": "^4.0.0",
"@josephg/resolvable": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-response-cache/package.json
Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@apollo/utils.createhash": "^2.0.0",
"@apollo/utils.keyvaluecache": "^2.0.1"
"@apollo/utils.keyvaluecache": "^2.1.0"
},
"peerDependencies": {
"@apollo/server": "^4.0.1",
Expand Down