Merge pull request #387 from grzuy/fix_redis_3_and_memory_store

[Fixes #355] Fix unexpected error when using redis 3 and any store which is not proxied
This commit is contained in:
Gonzalo Rodriguez 2018-10-08 11:33:34 -03:00 committed by GitHub
commit 014f74b95d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 3 deletions

View file

@ -19,6 +19,7 @@ gemfile:
- gemfiles/rails_4_2.gemfile
- gemfiles/dalli2.gemfile
- gemfiles/redis_4.gemfile
- gemfiles/redis_3.gemfile
- gemfiles/connection_pool_dalli.gemfile
- gemfiles/active_support_redis_cache_store.gemfile
- gemfiles/active_support_redis_cache_store_pooled.gemfile

View file

@ -44,6 +44,10 @@ appraise 'redis_4' do
gem 'redis', '~> 4.0'
end
appraise 'redis_3' do
gem 'redis', '~> 3.3'
end
appraise "connection_pool_dalli" do
gem "connection_pool", "~> 2.2"
gem "dalli", "~> 2.7"

9
gemfiles/redis_3.gemfile Normal file
View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
# This file was generated by Appraisal
source "https://rubygems.org"
gem "redis", "~> 3.3"
gemspec path: "../"

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 = {})

View file

@ -2,7 +2,7 @@
require_relative "../../spec_helper"
if defined?(::ConnectionPool) && defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisCacheStore)
if defined?(::ConnectionPool) && defined?(::Redis) && Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && defined?(::ActiveSupport::Cache::RedisCacheStore)
require_relative "../../support/cache_store_helper"
require "timecop"

View file

@ -2,7 +2,7 @@
require_relative "../../spec_helper"
if defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisCacheStore)
if defined?(::Redis) && Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && defined?(::ActiveSupport::Cache::RedisCacheStore)
require_relative "../../support/cache_store_helper"
require "timecop"