From 7d9a3fea6bd01440f86172ac09ac4091acf5905c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Mon, 13 Mar 2023 10:55:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91JeroRedisCacheWrit?= =?UTF-8?q?er=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/redis/writer/JeroRedisCacheWriter.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/writer/JeroRedisCacheWriter.java b/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/writer/JeroRedisCacheWriter.java index 9499d85b..ffc4e88e 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/writer/JeroRedisCacheWriter.java +++ b/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/writer/JeroRedisCacheWriter.java @@ -48,7 +48,7 @@ public class JeroRedisCacheWriter implements RedisCacheWriter { Assert.notNull(name, NAME_MUST_NOT_BE_NULL); Assert.notNull(key, KEY_MUST_NOT_BE_NULL); Assert.notNull(value, "Value must not be null!"); - this.execute(name, (connection) -> { + this.execute(name, connection -> { if (shouldExpireWithin(ttl)) { connection.set(key, value, Expiration.from(ttl.toMillis(), TimeUnit.MILLISECONDS), SetOption.upsert()); } else { @@ -63,7 +63,7 @@ public class JeroRedisCacheWriter implements RedisCacheWriter { public byte[] get(String name, byte[] key) { Assert.notNull(name, NAME_MUST_NOT_BE_NULL); Assert.notNull(key, KEY_MUST_NOT_BE_NULL); - return this.execute(name, (connection) -> connection.get(key)); + return this.execute(name, connection -> connection.get(key)); } @Override @@ -71,7 +71,7 @@ public class JeroRedisCacheWriter implements RedisCacheWriter { Assert.notNull(name, NAME_MUST_NOT_BE_NULL); Assert.notNull(key, KEY_MUST_NOT_BE_NULL); Assert.notNull(value, "Value must not be null!"); - return this.execute(name, (connection) -> { + return this.execute(name, connection -> { if (this.isLockingCacheWriter()) { this.doLock(name, connection); } @@ -118,7 +118,7 @@ public class JeroRedisCacheWriter implements RedisCacheWriter { return delNum; }); }else{ - this.execute(name, (connection) -> connection.del(new byte[][]{key})); + this.execute(name, connection -> connection.del(new byte[][]{key})); } } @@ -126,7 +126,7 @@ public class JeroRedisCacheWriter implements RedisCacheWriter { public void clean(String name, byte[] pattern) { Assert.notNull(name, NAME_MUST_NOT_BE_NULL); Assert.notNull(pattern, "Pattern must not be null!"); - this.execute(name, (connection) -> { + this.execute(name, connection -> { boolean wasLocked = false; try { @@ -151,11 +151,11 @@ public class JeroRedisCacheWriter implements RedisCacheWriter { } void lock(String name) { - this.execute(name, (connection) -> this.doLock(name, connection)); + this.execute(name, connection -> this.doLock(name, connection)); } void unlock(String name) { - this.executeLockFree((connection) -> this.doUnlock(name, connection)); + this.executeLockFree(connection -> this.doUnlock(name, connection)); } private Boolean doLock(String name, RedisConnection connection) {