lib/prop/limiter.rb in prop-2.0.3 vs lib/prop/limiter.rb in prop-2.0.4

- old
+ new

@@ -21,9 +21,17 @@ def cache=(cache) [:read, :write, :increment].each do |method| next if cache.respond_to?(method) raise ArgumentError, "Cache needs to respond to #{method}" end + + # https://github.com/petergoldstein/dalli/pull/481 + if defined?(ActiveSupport::Cache::DalliStore) && + cache.is_a?(ActiveSupport::Cache::DalliStore) && + Gem::Version.new(Dalli::VERSION) <= Gem::Version.new("2.7.4") + raise "Upgrade to dalli 2.7.5+ to use prop v2, it fixes a local_cache vs increment bug" + end + @cache = cache end def before_throttle(&blk) self.before_throttle_callback = blk