{"repo":"DmitryTsepelev/graphql-ruby-fragment_cache","free":true,"listed":false,"github":"https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache","clone":"git clone https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache.git","description":"graphql-ruby plugin for caching parts of the response","language":"Ruby","stars":234,"topics":["ruby","graphql","cache","graphql-ruby"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"GraphQL::FragmentCache GraphQL::FragmentCache powers up graphql-ruby with the ability to cache response fragments : you can mark any field as cached and it will never be resolved again (at least, while cache is valid). For instance, the following code caches title for each post: Professional Support Need help with your GraphQL API architecture, schema design, or performance? I'm available for consulting — get in touch. Getting started Add the gem to your Gemfile gem 'graphql-fragment cache' and add the plugin to your schema class: Include GraphQL::FragmentCache::Object to your base type class: If you're using resolvers — include the module into the base resolver as well: Now you can add cache fragment: option to your fields to turn caching on: Alternatively, you can use cache fragment method inside resolver methods: Cache key generation Cache keys consist of the following parts: namespace, implicit key, and explicit key. Cache namespace The namespace is prefixed to every cached key. The default namespace is graphql , which is configurable: Implicit cache key Implicit part of a cache key contains the information about the schema and the current query. It includes: - Hex gsdigest of the schema definition (to make sure cache is cleared when the schema changes). - The current query fingerprint consisting of a path to the field, arguments information and the selections set. Let's take a look at the example: You can override schema cache key , query cache key , path cache key or ob","default_branch":null,"files":null,"tree":[],"storefront":"/r/DmitryTsepelev","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/DmitryTsepelev/graphql-ruby-fragment_cache/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}