diff --git a/lib/discourse_redis.rb b/lib/discourse_redis.rb index 33390d4ca6f..45902dcac4b 100644 --- a/lib/discourse_redis.rb +++ b/lib/discourse_redis.rb @@ -37,7 +37,7 @@ class DiscourseRedis end # prefix the key with the namespace - def method_missing(meth, *args, &block) + def method_missing(meth, *args, **kwargs, &block) if @redis.respond_to?(meth) DiscourseRedis.ignore_readonly { @redis.public_send(meth, *args, &block) } else @@ -54,9 +54,9 @@ class DiscourseRedis :sdiff, :set, :setbit, :setex, :setnx, :setrange, :sinter, :sismember, :smembers, :sort, :spop, :srandmember, :srem, :strlen, :sunion, :ttl, :type, :watch, :zadd, :zcard, :zcount, :zincrby, :zrange, :zrangebyscore, :zrank, :zrem, :zremrangebyrank, :zremrangebyscore, :zrevrange, :zrevrangebyscore, :zrevrank, :zrangebyscore ].each do |m| - define_method m do |*args| + define_method m do |*args, **kwargs| args[0] = "#{namespace}:#{args[0]}" if @namespace - DiscourseRedis.ignore_readonly { @redis.public_send(m, *args) } + DiscourseRedis.ignore_readonly { @redis.public_send(m, *args, **kwargs) } end end