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-1.4.0.beta lib/skylight/normalizers/active_support/cache.rb
skylight-1.3.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.3.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.2.2 lib/skylight/normalizers/active_support/cache.rb
skylight-1.2.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.2.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.1.0 lib/skylight/normalizers/active_support/cache.rb
skylight-1.0.1 lib/skylight/normalizers/active_support/cache.rb
skylight-1.0.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.10.6 lib/skylight/normalizers/active_support/cache.rb
skylight-1.0.0.beta5 lib/skylight/normalizers/active_support/cache.rb
skylight-0.10.5 lib/skylight/normalizers/active_support/cache.rb
skylight-0.10.4 lib/skylight/normalizers/active_support/cache.rb
skylight-1.0.0.beta4 lib/skylight/normalizers/active_support/cache.rb
skylight-1.0.0.beta3 lib/skylight/normalizers/active_support/cache.rb
skylight-0.10.3 lib/skylight/normalizers/active_support/cache.rb
skylight-0.10.2 lib/skylight/normalizers/active_support/cache.rb
skylight-1.0.0.beta2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.10.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.9.4 lib/skylight/normalizers/active_support/cache.rb