module GraphQL::Cache

Constants

VERSION

Attributes

cache[RW]

An object that must conform to the same API as ActiveSupport::Cache::Store @return [Object] Defaults to `Rails.cache` in a Rails environment

expiry[RW]

Global default cache key expiration time in seconds. @return [Integer] Default: 5400 (90 minutes)

logger[RW]

Logger instance to use when logging cache hits/misses. @return [Logger]

namespace[RW]

Global namespace for keys @return [String] Default: “GraphQL::Cache”

Public Class Methods

configure() { |self| ... } click to toggle source

Provides for initializer syntax

“` GraphQL::Cache.configure do |c|

c.namespace = 'MyNamespace'

end “`

# File lib/graphql/cache.rb, line 35
def configure
  yield self
end
use(schema_def, options: {}) click to toggle source

Called by plugin framework in graphql-ruby to bootstrap necessary instrumentation and tracing tie-ins

# File lib/graphql/cache.rb, line 47
def self.use(schema_def, options: {})
  fetcher = ::GraphQL::Cache::Fetcher.new
  schema_def.instrument(:field, fetcher)
end