Class: GraphQL::Cache::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/cache/fetcher.rb

Instance Method Summary collapse

Instance Method Details

#instrument(type, field) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/graphql/cache/fetcher.rb', line 4

def instrument(type, field)
  return field unless field.[:cache]

  cached_resolve_proc = cached_resolve(type, field)

  # Return a copy of `field`, with the new resolve proc
  field.redefine { resolve(cached_resolve_proc) }
end