Skip to content

Commit 0850ddb

Browse files
committed
deleteFromCacheById clears DataLoader cache too
1 parent 6b06b43 commit 0850ddb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cache.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export const createCachingMethods = ({ collection, cache }) => {
4141
findManyByIds: (ids, { ttl } = {}) => {
4242
return Promise.all(ids.map(id => methods.findOneById(id, { ttl })))
4343
},
44-
deleteFromCacheById: id => cache.delete(cachePrefix + id)
44+
deleteFromCacheById: async id => {
45+
loader.clear(id)
46+
await cache.delete(cachePrefix + id)
47+
}
4548
}
4649

4750
return methods

0 commit comments

Comments
 (0)