|
@@ -101,7 +101,7 @@ public class RedisService { |
|
|
|
|
|
|
|
|
public boolean exists(String key) { return __exists(prefix(key), 0); } |
|
|
public boolean exists(String key) { return __exists(prefix(key), 0); } |
|
|
public boolean anyExists(Collection<String> keys) { |
|
|
public boolean anyExists(Collection<String> keys) { |
|
|
for (final var key : keys) { |
|
|
|
|
|
|
|
|
for (final String key : keys) { |
|
|
if (__exists(prefix(key), 0)) return true; |
|
|
if (__exists(prefix(key), 0)) return true; |
|
|
} |
|
|
} |
|
|
return false; |
|
|
return false; |
|
@@ -111,7 +111,7 @@ public class RedisService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public <T> T getObject(String key, Class<T> clazz) { |
|
|
public <T> T getObject(String key, Class<T> clazz) { |
|
|
final var json = __get(prefix(key), 0); |
|
|
|
|
|
|
|
|
final String json = __get(prefix(key), 0); |
|
|
return empty(json) ? null : fromJsonOrDie(decrypt(json), clazz); |
|
|
return empty(json) ? null : fromJsonOrDie(decrypt(json), clazz); |
|
|
} |
|
|
} |
|
|
public String get(String key) { return decrypt(__get(prefix(key), 0)); } |
|
|
public String get(String key) { return decrypt(__get(prefix(key), 0)); } |
|
@@ -130,8 +130,8 @@ public class RedisService { |
|
|
__set(prefix(key), encrypt(value), buildSetParams(nxxx, expx, time), 0); |
|
|
__set(prefix(key), encrypt(value), buildSetParams(nxxx, expx, time), 0); |
|
|
} |
|
|
} |
|
|
public void set(String key, String value, String expx, long time) { |
|
|
public void set(String key, String value, String expx, long time) { |
|
|
final var fullKey = prefix(key); |
|
|
|
|
|
final var preparedValue = encrypt(value); |
|
|
|
|
|
|
|
|
final String fullKey = prefix(key); |
|
|
|
|
|
final String preparedValue = encrypt(value); |
|
|
__set(fullKey, preparedValue, buildSetParams(XX, expx, time), 0); |
|
|
__set(fullKey, preparedValue, buildSetParams(XX, expx, time), 0); |
|
|
__set(fullKey, preparedValue, buildSetParams(NX, expx, time), 0); |
|
|
__set(fullKey, preparedValue, buildSetParams(NX, expx, time), 0); |
|
|
} |
|
|
} |
|
@@ -140,7 +140,7 @@ public class RedisService { |
|
|
__set(prefix(key), value, buildSetParams(nxxx, expx, time), 0); |
|
|
__set(prefix(key), value, buildSetParams(nxxx, expx, time), 0); |
|
|
} |
|
|
} |
|
|
public void set_plaintext(String key, String value, String expx, long time) { |
|
|
public void set_plaintext(String key, String value, String expx, long time) { |
|
|
final var fullKey = prefix(key); |
|
|
|
|
|
|
|
|
final String fullKey = prefix(key); |
|
|
__set(fullKey, value, buildSetParams(XX, expx, time), 0); |
|
|
__set(fullKey, value, buildSetParams(XX, expx, time), 0); |
|
|
__set(fullKey, value, buildSetParams(NX, expx, time), 0); |
|
|
__set(fullKey, value, buildSetParams(NX, expx, time), 0); |
|
|
} |
|
|
} |
|
@@ -171,7 +171,7 @@ public class RedisService { |
|
|
public Long del_withPrefix(String prefixedKey) { return __del(prefixedKey, 0); } |
|
|
public Long del_withPrefix(String prefixedKey) { return __del(prefixedKey, 0); } |
|
|
public Long del_matching(String keyMatch) { |
|
|
public Long del_matching(String keyMatch) { |
|
|
Long count = 0L; |
|
|
Long count = 0L; |
|
|
for (final var fullKey : keys(keyMatch)) { |
|
|
|
|
|
|
|
|
for (final String fullKey : keys(keyMatch)) { |
|
|
count += __del(fullKey, 0); |
|
|
count += __del(fullKey, 0); |
|
|
} |
|
|
} |
|
|
return count; |
|
|
return count; |
|
|