AbsintheCacheFairy.BeforeSend (absinthe_cache_fairy v0.2.2)
Cache & Persist API Call Data right before sending the response.
This module is responsible for persisting the whole result of some queries right before it is send to the client.
All queries that did not raise exceptions and were successfully handled by the GraphQL layer pass through this module.
The Blueprint's result field contains the final result as a single map.
This result is made up of the top-level resolver and all custom resolvers.
Caching the end result instead of each resolver separately allows to resolve the whole query with a single cache call - some queries could have thousands of custom resolver invocations.
In order to cache a result all of the following conditions must be true:
- All queries must be present in the
@cached_querieslist - The resolved value must not be an error
- During resolving there must not be any
:nocachereturned.
Most of the simple queries use 1 cache call and won't benefit from this approach. Only queries with many resolvers are included in the list of allowed queries.