|
@@ -118,6 +118,11 @@ public class RedisService { |
|
|
public String get_withPrefix(String prefixedKey) { return decrypt(__get(prefixedKey, 0)); } |
|
|
public String get_withPrefix(String prefixedKey) { return decrypt(__get(prefixedKey, 0)); } |
|
|
public String get_plaintext(String key) { return __get(prefix(key), 0); } |
|
|
public String get_plaintext(String key) { return __get(prefix(key), 0); } |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param key |
|
|
|
|
|
* @return TTL in seconds for the given key |
|
|
|
|
|
*/ |
|
|
|
|
|
public int get_ttl(final String key) { return __ttl(prefix(key), 0).intValue(); } |
|
|
|
|
|
|
|
|
public <T> void setObject(String key, T thing) { __set(prefix(key), encrypt(toJsonOrDie(thing)), 0); } |
|
|
public <T> void setObject(String key, T thing) { __set(prefix(key), encrypt(toJsonOrDie(thing)), 0); } |
|
|
public void set(String key, String value) { __set(prefix(key), encrypt(value), 0); } |
|
|
public void set(String key, String value) { __set(prefix(key), encrypt(value), 0); } |
|
@@ -332,6 +337,18 @@ public class RedisService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Long __ttl(final String fullKey, final int attempt) { |
|
|
|
|
|
try { |
|
|
|
|
|
synchronized (redis) { |
|
|
|
|
|
return getRedis().ttl(fullKey); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (RuntimeException e) { |
|
|
|
|
|
if (attempt > MAX_RETRIES) throw e; |
|
|
|
|
|
resetForRetry(attempt, "retrying RedisService.__ttl"); |
|
|
|
|
|
return __ttl(fullKey, attempt + 1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private boolean __exists(final String fullKey, final int attempt) { |
|
|
private boolean __exists(final String fullKey, final int attempt) { |
|
|
try { |
|
|
try { |
|
|
synchronized (redis) { |
|
|
synchronized (redis) { |
|
|