Module: GraphQL::FragmentCache

Defined in:
lib/graphql/fragment_cache.rb,
lib/graphql/fragment_cache/cacher.rb,
lib/graphql/fragment_cache/object.rb,
lib/graphql/fragment_cache/railtie.rb,
lib/graphql/fragment_cache/version.rb,
lib/graphql/fragment_cache/fragment.rb,
lib/graphql/fragment_cache/memory_store.rb,
lib/graphql/fragment_cache/schema/patch.rb,
lib/graphql/fragment_cache/schema/tracer.rb,
lib/graphql/fragment_cache/object_helpers.rb,
lib/graphql/fragment_cache/field_extension.rb,
lib/graphql/fragment_cache/cache_key_builder.rb,
lib/graphql/fragment_cache/connections/patch.rb,
lib/graphql/fragment_cache/graphql_ruby_version.rb,
lib/graphql/fragment_cache/ext/context_fragments.rb,
lib/graphql/fragment_cache/ext/graphql_cache_key.rb,
lib/graphql/fragment_cache/schema/instrumentation.rb,
lib/graphql/fragment_cache/rails/cache_key_builder.rb,
lib/graphql/fragment_cache/schema/lazy_cache_resolver.rb

Overview

Plugin definition

Defined Under Namespace

Modules: Cacher, Connections, Ext, GraphRubyVersion, Object, ObjectHelpers, Schema Classes: CacheKeyBuilder, FieldExtension, Fragment, MemoryStore, Railtie, WriteError, WriteMultiError

Constant Summary collapse

VERSION =
"1.20.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cache_storeObject

Returns the value of attribute cache_store.



26
27
28
# File 'lib/graphql/fragment_cache.rb', line 26

def cache_store
  @cache_store
end

.default_optionsObject

Returns the value of attribute default_options.



29
30
31
# File 'lib/graphql/fragment_cache.rb', line 29

def default_options
  @default_options
end

.enabledObject

Returns the value of attribute enabled.



27
28
29
# File 'lib/graphql/fragment_cache.rb', line 27

def enabled
  @enabled
end

.namespaceObject

Returns the value of attribute namespace.



28
29
30
# File 'lib/graphql/fragment_cache.rb', line 28

def namespace
  @namespace
end

.skip_cache_when_query_has_errorsObject Also known as: skip_cache_when_query_has_errors?

Returns the value of attribute skip_cache_when_query_has_errors.



31
32
33
# File 'lib/graphql/fragment_cache.rb', line 31

def skip_cache_when_query_has_errors
  @skip_cache_when_query_has_errors
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



49
50
51
# File 'lib/graphql/fragment_cache.rb', line 49

def configure
  yield self
end

.use(schema_defn, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/graphql/fragment_cache.rb', line 33

def use(schema_defn, options = {})
  verify_interpreter_and_analysis!(schema_defn)

  if GraphRubyVersion.after_2_2_5?
    schema_defn.trace_with(Schema::Instrumentation::Tracer)
  else
    schema_defn.tracer(Schema::Tracer)
    schema_defn.instrument(:query, Schema::Instrumentation)
  end

  schema_defn.extend(Schema::Patch)
  schema_defn.lazy_resolve(Schema::LazyCacheResolver, :resolve)

  GraphQL::Pagination::Connections.prepend(Connections::Patch)
end