Przeglądaj źródła

add get_withPrefix, for already-prefixed keys

tags/2.0.1
Jonathan Cobb 4 lat temu
rodzic
commit
0bfd8b9c79
1 zmienionych plików z 6 dodań i 1 usunięć
  1. +6
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java

+ 6
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java Wyświetl plik

@@ -114,6 +114,7 @@ public class RedisService {
}

public String get(String key) { return decrypt(__get(key, 0, MAX_RETRIES)); }
public String get_withPrefix(String prefixedKey) { return decrypt(__get(prefixedKey, 0, MAX_RETRIES, false)); }

public String get_plaintext(String key) { return __get(key, 0, MAX_RETRIES); }

@@ -316,9 +317,13 @@ public class RedisService {
}

private String __get(String key, int attempt, int maxRetries) {
return __get(key, attempt, maxRetries, true);
}

private String __get(String key, int attempt, int maxRetries, boolean applyPrefix) {
try {
synchronized (redis) {
return getRedis().get(prefix(key));
return getRedis().get(applyPrefix ? prefix(key) : key);
}
} catch (RuntimeException e) {
if (attempt > maxRetries) throw e;


Ładowanie…
Anuluj
Zapisz