소스 검색

add get_withPrefix, for already-prefixed keys

tags/2.0.1
Jonathan Cobb 4 년 전
부모
커밋
0bfd8b9c79
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  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 파일 보기

@@ -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;


불러오는 중...
취소
저장