mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 05:41:15 +08:00
FEATURE: allow distributed cache to handle Set as value
This commit is contained in:
@ -11,6 +11,34 @@ describe DistributedCache do
|
||||
DistributedCache.new("test")
|
||||
end
|
||||
|
||||
it 'allows us to store Set' do
|
||||
c1 = DistributedCache.new("test1")
|
||||
c2 = DistributedCache.new("test1")
|
||||
|
||||
set = {a: 1, b: 1}
|
||||
set = Set.new
|
||||
set << 1
|
||||
set << "b"
|
||||
|
||||
c1["cats"] = set
|
||||
|
||||
wait_for do
|
||||
c2["cats"] == set
|
||||
end
|
||||
|
||||
expect(c2["cats"]).to eq(set)
|
||||
|
||||
set << 5
|
||||
|
||||
c2["cats"] == set
|
||||
|
||||
wait_for do
|
||||
c1["cats"] == set
|
||||
end
|
||||
|
||||
expect(c1["cats"]).to eq(set)
|
||||
end
|
||||
|
||||
it 'does not leak state across caches' do
|
||||
c2 = DistributedCache.new("test1")
|
||||
c3 = DistributedCache.new("test1")
|
||||
|
Reference in New Issue
Block a user