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

Use new KeyValueCache and friends from @apollo/utils.keyvaluecache #6522

Merged
merged 11 commits into from Jun 7, 2022
2 changes: 2 additions & 0 deletions .prettierignore
Expand Up @@ -10,3 +10,5 @@ docs/.cache/

# Don't format generated files!
**/generated/**

.volta
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,8 +7,11 @@ The version headers in this history reflect the versions of Apollo Server itself
- [`@apollo/gateway`](https://github.com/apollographql/federation/blob/HEAD/gateway-js/CHANGELOG.md)
- [`@apollo/federation`](https://github.com/apollographql/federation/blob/HEAD/federation-js/CHANGELOG.md)


## vNEXT

- Remove internal dependency on `apollo-server-caching`, switch over to `@apollo/utils.keyvaluecache`. This PR specifically also introduces Keyv as an unbounded cache solution, but will replace with our own simple implementation in a follow-up PR targeting this minor version release. [PR #6522](https://github.com/apollographql/apollo-server/pull/6522)

## v3.8.2

- `apollo-server-core`: Fix usage reporting plugin "willResolveField called after stopTiming!" error caused by a race condition related to null bubbling. [Issue #4472](https://github.com/apollographql/apollo-server/issues/4472) [PR #6398](https://github.com/apollographql/apollo-server/pull/6398)
Expand Down Expand Up @@ -92,7 +95,7 @@ The version headers in this history reflect the versions of Apollo Server itself
new ApolloServer({
documentStore: new InMemoryLRUCache<DocumentNode>({
maxSize: Math.pow(2, 20) * approximateDocumentStoreMiB,
sizeCalculator: InMemoryLRUCache.jsonBytesSizeCalculator,
sizeCalculator: InMemoryLRUCache.sizeCalculator,
}),
...moreOptions,
})
Expand Down
2 changes: 2 additions & 0 deletions cspell-dict.txt
Expand Up @@ -79,6 +79,8 @@ iteratees
josephg
jsdelivr
keyv
keyvadapter
keyvaluecache
KHTML
Kubernetes
linearizability
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/apollo-server.mdx
Expand Up @@ -209,12 +209,12 @@ To use `InMemoryLRUCache` but change its size to an amount `approximateDocumentS
<div style="max-width: 400px;">

```typescript
import { InMemoryLRUCache } from 'apollo-server-caching';
import { InMemoryLRUCache } from '@apollo/utils.keyvaluecache';
import type { DocumentNode } from 'graphql';
new ApolloServer({
documentStore: new InMemoryLRUCache<DocumentNode>({
maxSize: Math.pow(2, 20) * approximateDocumentStoreMiB,
sizeCalculator: InMemoryLRUCache.jsonBytesSizeCalculator,
sizeCalculation: InMemoryLRUCache.sizeCalculation,
}),
// ...
})
Expand Down