Module: GraphQL::FragmentCache::Railtie::Config

Defined in:
lib/graphql/fragment_cache/railtie.rb

Overview

Provides Rails-specific configuration, accessible through ‘Rails.application.config.graphql_fragment_cache`

Class Method Summary collapse

Class Method Details

.store=(store) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/graphql/fragment_cache/railtie.rb', line 12

def store=(store)
  if Rails.version.to_f >= 7.0 && Rails.application
    cache_format_version = 7.0
    ActiveSupport::Cache.format_version = cache_format_version if cache_format_version
  end

  # Handle both:
  #   store = :memory
  #   store = :mem_cache, ENV['MEMCACHE']
  if store.is_a?(Symbol) || store.is_a?(Array)
    store = ActiveSupport::Cache.lookup_store(store)
  end

  FragmentCache.cache_store = store
end