Sha256: 0fa816ae04c4b3eec724a0d4f7d04546385ccb572fe832f7e8b2ffa5e6abc1c9

Contents?: true

Size: 1.42 KB

Versions: 53

Compression:

Stored size: 1.42 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
    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

53 entries across 53 versions & 2 rubygems

Version Path
skylight-0.4.3 lib/skylight/normalizers/active_support/cache.rb
skylight-0.5.0.beta1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.4.2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.4.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.4.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.4.0.beta2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.4.0.beta1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.4.0.alpha1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.3.21 lib/skylight/normalizers/active_support/cache.rb
skylight-0.3.20 lib/skylight/normalizers/active_support/cache.rb
skylight-0.3.19 lib/skylight/normalizers/active_support/cache.rb
skylight-0.3.18 lib/skylight/normalizers/active_support/cache.rb
skylight-0.3.17 lib/skylight/normalizers/active_support/cache.rb