Class: GraphQL::ResultCache::Schema::FieldExtension
- Inherits:
-
Schema::FieldExtension
- Object
- Schema::FieldExtension
- GraphQL::ResultCache::Schema::FieldExtension
- Defined in:
- lib/graphql/result_cache/schema/field_extension.rb
Instance Method Summary collapse
Instance Method Details
#resolve(object:, arguments:, context:) {|object, arguments| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/graphql/result_cache/schema/field_extension.rb', line 12 def resolve(object:, arguments:, context:) cache_config = .respond_to?(:to_h) ? .to_h : {} if Condition.new(cache_config, obj: object, args: arguments, ctx: context).true? context[:result_cache] ||= ContextConfig.new cached = add_to_context_result_cache(context, object, arguments, cache_config) end yield(object, arguments) unless cached end |