Skip to content

Commit

Permalink
Use new KeyValueCache and friends from @apollo/utils.keyvaluecache (
Browse files Browse the repository at this point in the history
#6522)

Migrate caching dependencies away from `apollo-server-caching` which will
no longer be actively developed as of AS v3.9.0.

AS will now use `@apollo/utils.keyvaluecache` and support the use of `keyv`
caches via a `KeyvAdapter` exported by `@apollo/utils.keyvadapter`.
  • Loading branch information
trevor-scheer committed Jun 7, 2022
1 parent 6a5242a commit 42fa0b8
Show file tree
Hide file tree
Showing 35 changed files with 286 additions and 84 deletions.
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

0 comments on commit 42fa0b8

Please sign in to comment.