Prisma1: Support memory/redis/etc cache between prisma & database

Created on 22 Sep 2018  路  2Comments  路  Source: prisma/prisma1

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
  })
kinfeature

Most helpful comment

Is there any update on this feature?

All 2 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tbrannam picture tbrannam  路  3Comments

ragnorc picture ragnorc  路  3Comments

thomaswright picture thomaswright  路  3Comments

schickling picture schickling  路  3Comments

sorenbs picture sorenbs  路  3Comments