File tree 3 files changed +31
-0
lines changed
3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ * Support `.unlink()` in ClusterPipeline
1
2
* Simplify synchronous SocketBuffer state management
2
3
* Fix string cleanse in Redis Graph
3
4
* Make PythonParser resumable in case of error (#2510)
Original file line number Diff line number Diff line change @@ -2136,6 +2136,17 @@ def delete(self, *names):
2136
2136
2137
2137
return self .execute_command ("DEL" , names [0 ])
2138
2138
2139
+ def unlink (self , * names ):
2140
+ """
2141
+ "Unlink a key specified by ``names``"
2142
+ """
2143
+ if len (names ) != 1 :
2144
+ raise RedisClusterException (
2145
+ "unlinking multiple keys is not implemented in pipeline command"
2146
+ )
2147
+
2148
+ return self .execute_command ("UNLINK" , names [0 ])
2149
+
2139
2150
2140
2151
def block_pipeline_command (name : str ) -> Callable [..., Any ]:
2141
2152
"""
Original file line number Diff line number Diff line change @@ -2703,6 +2703,25 @@ def test_multi_delete_unsupported(self, r):
2703
2703
with pytest .raises (RedisClusterException ):
2704
2704
pipe .delete ("a" , "b" )
2705
2705
2706
+ def test_unlink_single (self , r ):
2707
+ """
2708
+ Test a single unlink operation
2709
+ """
2710
+ r ["a" ] = 1
2711
+ with r .pipeline (transaction = False ) as pipe :
2712
+ pipe .unlink ("a" )
2713
+ assert pipe .execute () == [1 ]
2714
+
2715
+ def test_multi_unlink_unsupported (self , r ):
2716
+ """
2717
+ Test that multi unlink operation is unsupported
2718
+ """
2719
+ with r .pipeline (transaction = False ) as pipe :
2720
+ r ["a" ] = 1
2721
+ r ["b" ] = 2
2722
+ with pytest .raises (RedisClusterException ):
2723
+ pipe .unlink ("a" , "b" )
2724
+
2706
2725
def test_brpoplpush_disabled (self , r ):
2707
2726
"""
2708
2727
Test that brpoplpush is disabled for ClusterPipeline
You can’t perform that action at this time.
0 commit comments