Skip to content

๐Ÿ˜ Server-side caching for your GraphQL resolvers.

License

Notifications You must be signed in to change notification settings

flesch/graphql-memo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

graphql-memo

$ npm install --save graphql-memo
import memo from 'graphql-memo';

const { cache } = memo({ store: new Map() });

const Query = new GraphQLObjectType({
  name: 'Query',
  fields: () => ({
    hello: {
      type: GraphQLString,
      args: {
        name: { type: GraphQLString, defaultValue: 'world' },
      },
-     resolve: async (root, { name }, context, info) => {
-       return Promise.resolve(name);
-     },
+     resolve: cache(async (root, { name }, context, info) => {
+       return Promise.resolve(name);
+     }),
    },
  }),
});

๐Ÿ˜

About

๐Ÿ˜ Server-side caching for your GraphQL resolvers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published