Skip to content

Commit d67605e

Browse files
committed
Fix caching
1 parent fb6c6f2 commit d67605e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ export const createCachingMethods = ({ collection, cache }) => {
2727

2828
const cacheDoc = await cache.get(key)
2929
if (cacheDoc) {
30-
return cacheDoc
30+
return JSON.parse(cacheDoc)
3131
}
3232

3333
const doc = await loader.load(id)
3434
if (Number.isInteger(ttl)) {
3535
// https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-caching#apollo-server-caching
36-
cache.set(key, doc, { ttl })
36+
cache.set(key, JSON.stringify(doc), { ttl })
3737
}
3838

3939
return doc

0 commit comments

Comments
 (0)