Module: GraphQL::ResultCache
- Defined in:
- lib/graphql/result_cache.rb,
lib/graphql/result_cache/key.rb,
lib/graphql/result_cache/rails.rb,
lib/graphql/result_cache/result.rb,
lib/graphql/result_cache/version.rb,
lib/graphql/result_cache/callback.rb,
lib/graphql/result_cache/condition.rb,
lib/graphql/result_cache/schema/field.rb,
lib/graphql/result_cache/introspection.rb,
lib/graphql/result_cache/context_config.rb,
lib/graphql/result_cache/schema/field_extension.rb,
lib/graphql/result_cache/schema/query_instrument.rb,
lib/graphql/result_cache/introspection/field_type.rb
Defined Under Namespace
Modules: Introspection, Schema Classes: Callback, Condition, ContextConfig, Key, Rails, Result
Constant Summary collapse
- VERSION =
'1.0.0'
Class Attribute Summary collapse
-
.cache ⇒ Object
Returns the value of attribute cache.
-
.cache_write_options ⇒ Object
Returns the value of attribute cache_write_options.
-
.client_hash ⇒ Object
to expire the cache when client hash changes, should be a proc.
-
.except ⇒ Object
global condition, skip the cache when the value is true, should be a proc.
-
.expires_in ⇒ Object
Returns the value of attribute expires_in.
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.namespace ⇒ Object
Returns the value of attribute namespace.
Class Method Summary collapse
-
.configure {|_self| ... } ⇒ Object
“‘ GraphQL::ResultCache.configure do |c| c.namespace = “GraphQL:Result” c.expires_in = 1.hour c.client_hash = -> { Rails.cache.read(:deploy_version) } end “`.
- .use(schema_def) ⇒ Object
Class Attribute Details
.cache ⇒ Object
Returns the value of attribute cache.
14 15 16 |
# File 'lib/graphql/result_cache.rb', line 14 def cache @cache end |
.cache_write_options ⇒ Object
Returns the value of attribute cache_write_options.
15 16 17 |
# File 'lib/graphql/result_cache.rb', line 15 def end |
.client_hash ⇒ Object
to expire the cache when client hash changes, should be a proc. eg: c.client_hash = -> { Rails.cache.read(:deploy_version) }
20 21 22 |
# File 'lib/graphql/result_cache.rb', line 20 def client_hash @client_hash end |
.except ⇒ Object
global condition, skip the cache when the value is true, should be a proc.
23 24 25 |
# File 'lib/graphql/result_cache.rb', line 23 def except @except end |
.expires_in ⇒ Object
Returns the value of attribute expires_in.
12 13 14 |
# File 'lib/graphql/result_cache.rb', line 12 def expires_in @expires_in end |
.logger ⇒ Object
Returns the value of attribute logger.
16 17 18 |
# File 'lib/graphql/result_cache.rb', line 16 def logger @logger end |
.namespace ⇒ Object
Returns the value of attribute namespace.
13 14 15 |
# File 'lib/graphql/result_cache.rb', line 13 def namespace @namespace end |
Class Method Details
.configure {|_self| ... } ⇒ Object
“‘ GraphQL::ResultCache.configure do |c|
c.namespace = "GraphQL:Result"
c.expires_in = 1.hour
c.client_hash = -> { Rails.cache.read(:deploy_version) }
end “‘
32 33 34 |
# File 'lib/graphql/result_cache.rb', line 32 def configure yield self end |
.use(schema_def) ⇒ Object
36 37 38 39 |
# File 'lib/graphql/result_cache.rb', line 36 def use(schema_def) return schema_def.instrument(:query, Schema::QueryInstrument) if schema_def.interpreter? raise 'Please use the graphql gem version >= 1.10 with GraphQL::Execution::Interpreter' end |