【fix sonar】JeroRedisCacheWriter文件

This commit is contained in:
梁琦涛
2023-03-13 10:55:02 +08:00
parent b3b6275915
commit 7d9a3fea6b
@@ -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) {