From 9b4433fddf5b401edb0aace8a404ac733b122702 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期四, 03 四月 2025 14:35:02 +0800
Subject: [PATCH] 添加非密字段显示

---
 Source/BladeX-Tool/blade-starter-redis/src/main/java/org/springblade/core/redis/lock/RedisLockClient.java |   91 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/Source/BladeX-Tool/blade-starter-redis/src/main/java/org/springblade/core/redis/lock/RedisLockClient.java b/Source/BladeX-Tool/blade-starter-redis/src/main/java/org/springblade/core/redis/lock/RedisLockClient.java
new file mode 100644
index 0000000..51dba71
--- /dev/null
+++ b/Source/BladeX-Tool/blade-starter-redis/src/main/java/org/springblade/core/redis/lock/RedisLockClient.java
@@ -0,0 +1,91 @@
+/*
+ *      Copyright (c) 2018-2028, DreamLu All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: DreamLu 鍗㈡槬姊� (596392912@qq.com)
+ */
+
+package org.springblade.core.redis.lock;
+
+import org.springblade.core.tool.function.CheckedSupplier;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 閿佸鎴风
+ *
+ * @author L.cm
+ */
+public interface RedisLockClient {
+
+	/**
+	 * 灏濊瘯鑾峰彇閿�
+	 *
+	 * @param lockName  閿佸悕
+	 * @param lockType  閿佺被鍨�
+	 * @param waitTime  绛夊緟鏃堕棿
+	 * @param leaseTime 鑷姩瑙i攣鏃堕棿锛岃嚜鍔ㄨВ閿佹椂闂翠竴瀹氬緱澶т簬鏂规硶鎵ц鏃堕棿
+	 * @param timeUnit  鏃堕棿鍙傛暟
+	 * @return 鏄惁鎴愬姛
+	 * @throws InterruptedException InterruptedException
+	 */
+	boolean tryLock(String lockName, LockType lockType, long waitTime, long leaseTime, TimeUnit timeUnit) throws InterruptedException;
+
+	/**
+	 * 瑙i攣
+	 *
+	 * @param lockName 閿佸悕
+	 * @param lockType 閿佺被鍨�
+	 */
+	void unLock(String lockName, LockType lockType);
+
+	/**
+	 * 鑷畾鑾峰彇閿佸悗鎵ц鏂规硶
+	 *
+	 * @param lockName  閿佸悕
+	 * @param lockType  閿佺被鍨�
+	 * @param waitTime  绛夊緟閿佽秴鏃舵椂闂�
+	 * @param leaseTime 鑷姩瑙i攣鏃堕棿锛岃嚜鍔ㄨВ閿佹椂闂翠竴瀹氬緱澶т簬鏂规硶鎵ц鏃堕棿锛屽惁鍒欎細瀵艰嚧閿佹彁鍓嶉噴鏀撅紝榛樿100
+	 * @param timeUnit  鏃堕棿鍗曚綅
+	 * @param supplier  鑾峰彇閿佸悗鐨勫洖璋�
+	 * @return 杩斿洖鐨勬暟鎹�
+	 */
+	<T> T lock(String lockName, LockType lockType, long waitTime, long leaseTime, TimeUnit timeUnit, CheckedSupplier<T> supplier);
+
+	/**
+	 * 鍏钩閿�
+	 *
+	 * @param lockName  閿佸悕
+	 * @param waitTime  绛夊緟閿佽秴鏃舵椂闂�
+	 * @param leaseTime 鑷姩瑙i攣鏃堕棿锛岃嚜鍔ㄨВ閿佹椂闂翠竴瀹氬緱澶т簬鏂规硶鎵ц鏃堕棿锛屽惁鍒欎細瀵艰嚧閿佹彁鍓嶉噴鏀撅紝榛樿100
+	 * @param supplier  鑾峰彇閿佸悗鐨勫洖璋�
+	 * @return 杩斿洖鐨勬暟鎹�
+	 */
+	default <T> T lockFair(String lockName, long waitTime, long leaseTime, CheckedSupplier<T> supplier) {
+		return lock(lockName, LockType.FAIR, waitTime, leaseTime, TimeUnit.SECONDS, supplier);
+	}
+
+	/**
+	 * 鍙噸鍏ラ攣
+	 *
+	 * @param lockName  閿佸悕
+	 * @param waitTime  绛夊緟閿佽秴鏃舵椂闂�
+	 * @param leaseTime 鑷姩瑙i攣鏃堕棿锛岃嚜鍔ㄨВ閿佹椂闂翠竴瀹氬緱澶т簬鏂规硶鎵ц鏃堕棿锛屽惁鍒欎細瀵艰嚧閿佹彁鍓嶉噴鏀撅紝榛樿100
+	 * @param supplier  鑾峰彇閿佸悗鐨勫洖璋�
+	 * @return 杩斿洖鐨勬暟鎹�
+	 */
+	default <T> T lockReentrant(String lockName, long waitTime, long leaseTime, CheckedSupplier<T> supplier) {
+		return lock(lockName, LockType.REENTRANT, waitTime, leaseTime, TimeUnit.SECONDS, supplier);
+	}
+
+}

--
Gitblit v1.9.3