[Fixes #355] Avoid unexpected 'Gem::LoadError' for redis when not intented to be used

It seems that the original implementation accidentally autoloaded ActiveSupport::Cache::RedisCacheStore
which once evaluated asks for redis v4 generating Gem::LoadError.

In order to bypass any unnecessary constant autoloading we can just check class name string.
This commit is contained in:
Gonzalo Rodriguez 2018-09-30 22:11:16 -03:00
parent 82c0a17dd4
commit 935f99a638
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1

View file

@ -7,7 +7,7 @@ module Rack
module StoreProxy
class RedisCacheStoreProxy < SimpleDelegator
def self.handle?(store)
defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisCacheStore) && store.is_a?(::ActiveSupport::Cache::RedisCacheStore)
store.class.name == "ActiveSupport::Cache::RedisCacheStore"
end
def increment(name, amount = 1, options = {})