Sha256: 3d27ee19c3b18949cb46c3350dd19c432097fed63c56ff6a4b0bb7cb2bac6f9f

Contents?: true

Size: 1.44 KB

Versions: 13

Compression:

Stored size: 1.44 KB

Contents

module Skylight
  module Normalizers
    module ActiveSupport
      # NOTE: Instrumentation may not be turned on by default and is possibly buggy
      # https://github.com/mperham/dalli/pull/284
      class Cache < Normalizer
        %w(clear
            decrement
            delete
            exist
            fetch_hit
            generate
            increment
            read
            read_multi
            write).each do |type|
          require "skylight/normalizers/active_support/cache_#{type}"
        end
      end
    end
  end
end

# See https://github.com/rails/rails/pull/15943
if defined?(ActiveSupport::Cache::Store.instrument)
  deprecated = false

  # If it's deprecated, setting to false will cause a deprecation warning
  # and the value will remain true
  ActiveSupport::Deprecation.silence do
    ActiveSupport::Cache::Store.instrument = false
    deprecated = ActiveSupport::Cache::Store.instrument
  end

  unless deprecated
    # @api private
    class ActiveSupport::Cache::Store
      def self.instrument
        true
      end

      def self.instrument=(val)
        unless val
          Rails.logger.warn "[WARNING] Skylight has patched ActiveSupport::Cache::Store.instrument to always be true. " \
                            "In future versions of Rails, this method will no longer be settable. " \
                            "See https://github.com/rails/rails/pull/15943 for more information."
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
skylight-1.7.2 lib/skylight/normalizers/active_support/cache.rb
skylight-1.7.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.7.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.6.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.6.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.5.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.5.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.4.4 lib/skylight/normalizers/active_support/cache.rb
skylight-1.4.3 lib/skylight/normalizers/active_support/cache.rb
skylight-1.4.2 lib/skylight/normalizers/active_support/cache.rb
skylight-1.4.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.4.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.4.0.beta.2 lib/skylight/normalizers/active_support/cache.rb