lib/cacheflow.rb in cacheflow-0.3.0 vs lib/cacheflow.rb in cacheflow-0.3.1

- old
+ new

@@ -1,15 +1,15 @@ # dependencies require "active_support" # modules -require "cacheflow/version" +require_relative "cacheflow/version" module Cacheflow def self.activate - require "cacheflow/memcached" if defined?(Dalli) - require "cacheflow/redis" if defined?(Redis) || defined?(RedisClient) + 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 @@ -23,35 +23,14 @@ Thread.current[:cacheflow_silenced] = previous_value end end def self.silence_sidekiq! - ::Sidekiq.singleton_class.prepend(Cacheflow::Sidekiq::ClassMethods) - ::Sidekiq::Client.prepend(Cacheflow::Sidekiq::Client::InstanceMethods) + require_relative "cacheflow/sidekiq" end - - module Sidekiq - module ClassMethods - def redis(*_) - Cacheflow.silence do - super - end - end - end - - module Client - module InstanceMethods - def push(*_) - Cacheflow.silence do - super - end - end - end - end - end end if defined?(Rails) - require "cacheflow/railtie" + require_relative "cacheflow/railtie" else Cacheflow.activate end