DmitryTsepelev/graphql-ruby-fragment_cache

Allow override context cache key

DmitryTsepelev opened this issue · 0 comments

class QueryType < GraphQL::Schema::Object
  field :post, PostType, null: true do
    argument :id, ID, required: true
  end

  def post(id:)
    cache_fragment(context_cache_key: context[:current_user_id]) { Post.find(id) }
  end
end