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.9.3 lib/skylight/normalizers/active_support/cache.rb
skylight-0.9.2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.9.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.9.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.8.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.8.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.8.0.beta.3 lib/skylight/normalizers/active_support/cache.rb
skylight-0.8.0.beta.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.7.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.7.0.beta.3 lib/skylight/normalizers/active_support/cache.rb
truex-skylight-0.6.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.7.0.beta.2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.7.0.beta.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.6.2.beta.2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.6.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.6.0 lib/skylight/normalizers/active_support/cache.rb
skylight-0.6.0.beta.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.5.2 lib/skylight/normalizers/active_support/cache.rb
skylight-0.5.1 lib/skylight/normalizers/active_support/cache.rb
skylight-0.5.0 lib/skylight/normalizers/active_support/cache.rb