File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ * Support `.unlink()` in ClusterPipeline
12 * Simplify synchronous SocketBuffer state management
23 * Fix string cleanse in Redis Graph
34 * 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):
21362136
21372137 return self .execute_command ("DEL" , names [0 ])
21382138
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+
21392150
21402151def block_pipeline_command (name : str ) -> Callable [..., Any ]:
21412152 """
Original file line number Diff line number Diff line change @@ -2703,6 +2703,25 @@ def test_multi_delete_unsupported(self, r):
27032703 with pytest .raises (RedisClusterException ):
27042704 pipe .delete ("a" , "b" )
27052705
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+
27062725 def test_brpoplpush_disabled (self , r ):
27072726 """
27082727 Test that brpoplpush is disabled for ClusterPipeline
You can’t perform that action at this time.
0 commit comments