DEV: Upgrade Redis to 4.8

This commit is contained in:
Alan Guo Xiang Tan 2022-08-24 14:28:06 +08:00
parent 7f198bd975
commit 0b5a0fd857
3 changed files with 25 additions and 5 deletions

View File

@ -229,7 +229,7 @@ GEM
logstash-event (1.2.02)
logstash-logger (0.26.1)
logstash-event (~> 1.2)
logster (2.11.2)
logster (2.11.3)
loofah (2.18.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
@ -375,7 +375,7 @@ GEM
msgpack (>= 0.4.3)
optimist (>= 3.0.0)
rchardet (1.8.0)
redis (4.7.1)
redis (4.8.0)
redis-namespace (1.9.0)
redis (>= 4)
regexp_parser (2.5.0)
@ -643,4 +643,4 @@ DEPENDENCIES
yaml-lint
BUNDLED WITH
2.3.18
2.3.20

View File

@ -50,8 +50,8 @@ class DiscourseRedis
:hdel, :hexists, :hget, :hgetall, :hincrby, :hincrbyfloat, :hkeys, :hlen, :hmget, :hmset, :hset, :hsetnx, :hvals, :incr,
:incrby, :incrbyfloat, :lindex, :linsert, :llen, :lpop, :lpush, :lpushx, :lrange, :lrem, :lset, :ltrim,
:mapped_hmset, :mapped_hmget, :mapped_mget, :mapped_mset, :mapped_msetnx, :move, :mset,
:msetnx, :persist, :pexpire, :pexpireat, :psetex, :pttl, :rename, :renamenx, :rpop, :rpoplpush, :rpush, :rpushx, :sadd, :scard,
:sdiff, :set, :setbit, :setex, :setnx, :setrange, :sinter, :sismember, :smembers, :sort, :spop, :srandmember, :srem, :strlen,
:msetnx, :persist, :pexpire, :pexpireat, :psetex, :pttl, :rename, :renamenx, :rpop, :rpoplpush, :rpush, :rpushx, :sadd, :sadd?, :scard,
:sdiff, :set, :setbit, :setex, :setnx, :setrange, :sinter, :sismember, :smembers, :sort, :spop, :srandmember, :srem, :srem?, :strlen,
:sunion, :ttl, :type, :watch, :zadd, :zcard, :zcount, :zincrby, :zrange, :zrangebyscore, :zrank, :zrem, :zremrangebyrank,
:zremrangebyscore, :zrevrange, :zrevrangebyscore, :zrevrank, :zrangebyscore,
:dump, :restore].each do |m|

View File

@ -113,6 +113,26 @@ RSpec.describe DiscourseRedis do
expect(redis.mget('key1', 'key2')).to eq(['1', '2'])
expect(redis.scan_each.to_a).to contain_exactly('key1', 'key2')
end
describe '#sadd?' do
it "should send the right command with the right key prefix to redis" do
redis = DiscourseRedis.new
redis.without_namespace.expects(:sadd?).with("default:testset", "1")
redis.sadd?("testset", "1")
end
end
describe '#srem?' do
it "should send the right command with the right key prefix to redis" do
redis = DiscourseRedis.new
redis.without_namespace.expects(:srem?).with("default:testset", "1")
redis.srem?("testset", "1")
end
end
end
describe 'when namespace is disabled' do