graphql-python / graphene-django

Build powerful, efficient, and flexible GraphQL APIs with seamless Django integration.

Home Page:http://docs.graphene-python.org/projects/django/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Caching attribute on query resolver

manhtd98 opened this issue · comments

I have a query that calculates 1 value on each resolver value like this:

class ProductType(ObjectType):
    product = graphene.GlobalID(required=True)
    @staticmethod
    def resolve_products(root, info):
       q = calculate()
    def resolve_item(root, info):
       q = calculate()

Have some method to calculate only 1 time and cache it on the resolver.