In production it's common to have a redis server working as cache between application servers and database server:
app1, app2, app3... ------> cache in memory/redis/.. ------> postgres
GraphQl+prisma could make it easy to manage such a key-value based cache: in queries we know the _typename and id of the resource as well as its fields being queried, and in resolvers and returned values of mutations we can know which resourses are to be changed and so the corresponding cache items are to be purged.
Apollo client already implemented such a cache system (https://www.apollographql.com/docs/react/advanced/caching.html). I wonder if prisma could do the simple thing, automatically caching data into a provided middle cache system. Something like:
const {createRedisCache} = require('prisma-binding') //?
const prisma = new Prisma({
typeDefs: join(__dirname, 'generated/prisma.graphql'),
endpoint: 'http://localhost:4466',
debug: !!process.env.DEBUG,
cache: createRedisCache({ url: 'REDIS_CACHE_URL' }) // config cache when initializing prisma
})
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
Is there any update on this feature?
Most helpful comment
Is there any update on this feature?