@@ -146,6 +146,49 @@ def test_cache_return_copy(self, r):
146
146
check = cache .get (("LRANGE" , "mylist" , 0 , - 1 ))
147
147
assert check == [b"baz" , b"bar" , b"foo" ]
148
148
149
+ @pytest .mark .onlynoncluster
150
+ @pytest .mark .parametrize (
151
+ "r" ,
152
+ [{"cache" : _LocalCache (), "kwargs" : {"decode_responses" : True }}],
153
+ indirect = True ,
154
+ )
155
+ def test_csc_not_cause_disconnects (self , r ):
156
+ r , cache = r
157
+ id1 = r .client_id ()
158
+ r .mset ({"a" : 1 , "b" : 1 , "c" : 1 , "d" : 1 , "e" : 1 , "f" : 1 })
159
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["1" , "1" , "1" , "1" , "1" , "1" ]
160
+ id2 = r .client_id ()
161
+
162
+ # client should get value from client cache
163
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["1" , "1" , "1" , "1" , "1" , "1" ]
164
+ assert cache .get (("MGET" , "a" , "b" , "c" , "d" , "e" , "f" )) == [
165
+ "1" ,
166
+ "1" ,
167
+ "1" ,
168
+ "1" ,
169
+ "1" ,
170
+ "1" ,
171
+ ]
172
+
173
+ r .mset ({"a" : 2 , "b" : 2 , "c" : 2 , "d" : 2 , "e" : 2 , "f" : 2 })
174
+ id3 = r .client_id ()
175
+ # client should get value from redis server post invalidate messages
176
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["2" , "2" , "2" , "2" , "2" , "2" ]
177
+
178
+ r .mset ({"a" : 3 , "b" : 3 , "c" : 3 , "d" : 3 , "e" : 3 , "f" : 3 })
179
+ # need to check that we get correct value 3 and not 2
180
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["3" , "3" , "3" , "3" , "3" , "3" ]
181
+ # client should get value from client cache
182
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["3" , "3" , "3" , "3" , "3" , "3" ]
183
+
184
+ r .mset ({"a" : 4 , "b" : 4 , "c" : 4 , "d" : 4 , "e" : 4 , "f" : 4 })
185
+ # need to check that we get correct value 4 and not 3
186
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["4" , "4" , "4" , "4" , "4" , "4" ]
187
+ # client should get value from client cache
188
+ assert r .mget ("a" , "b" , "c" , "d" , "e" , "f" ) == ["4" , "4" , "4" , "4" , "4" , "4" ]
189
+ id4 = r .client_id ()
190
+ assert id1 == id2 == id3 == id4
191
+
149
192
150
193
@pytest .mark .skipif (HIREDIS_AVAILABLE , reason = "PythonParser only" )
151
194
@pytest .mark .onlycluster
0 commit comments