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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -86,7 +86,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