Closed hendrul closed 6 years ago
Ok! I see, replacing wrapping or modifying PgIntrospectionPlugin so it try to load a serialized previous introspection result from caches, or introspecting if non is found or throwing an error. I have to feed the cache manually or on demand if I decide to allow the introspection, save the result in a global variable of the lambda handler and the serialized version of the result to an S3 bucket or maybe a DynamoDB table for second cache storage
Do read the release notes here regarding caches:
https://github.com/postgraphql/postgraphql/releases/tag/v4.0.0-alpha2.28
My is case is I would like to pre-generate and cache a graphile schema and stitch it with other resolvers in an AWS Lambda Function to seamlessly integrate postgraphile into a serverless infrastructure with AWS AppSync.
I know AWS Lambda Functions are stateless by nature, but you can cache data in other AWS Services like S3, ElasticCache, DynamoDB, RDS, etc... and also you can occationally reuse resources in global variables, as you can see in this experiment. My strategy for caching is having a 1st cache storing the schema in a global variable, and if not there resorting to retrieve it from a persistence service like S3, but this 2nd caching strategy would require the schema to be dehydrated and rehydrated. Is it posible to add this functionality? and be able to serialize store and deserialize a graphile schema?.
What I wan't to avoid is doing a re-introspection from the DB on every lambda invocation. Maybe what I need is caching only the result of the schema introspection and use it every time to instantiate a new executable schema?