Sha256: 9e22f65bfbc88ce93290f6c44c143ad655735929e53f2d1a4887b283cc6c9285

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

# dependencies
require "active_support"

# modules
require_relative "cacheflow/version"

module Cacheflow
  def self.activate
    require_relative "cacheflow/memcached" if defined?(Dalli)
    require_relative "cacheflow/redis" if defined?(Redis) || defined?(RedisClient)
  end

  def self.silenced?
    Thread.current[:cacheflow_silenced]
  end

  def self.silence
    previous_value = silenced?
    begin
      Thread.current[:cacheflow_silenced] = true
      yield
    ensure
      Thread.current[:cacheflow_silenced] = previous_value
    end
  end

  def self.silence_sidekiq!
    require_relative "cacheflow/sidekiq"
  end
end

if defined?(Rails)
  require_relative "cacheflow/railtie"
else
  Cacheflow.activate
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cacheflow-0.3.2 lib/cacheflow.rb
cacheflow-0.3.1 lib/cacheflow.rb