Java Client 사용시 주의사항
Counter 사용
client.set("my_counter", 10000, 100); // 사실은 절대 이렇게 사용하면 안된다!Future<Long> f = client.asyncIncr("my_counter", 1);
Object o = f.get(1000, TimeUnit.MILLISECONDS);client.set("my_counter", 10000, "100"); // 반드시 이렇게 사용해야 한다!Operation Queue Block Timeout 설정
Future<Boolean> future = null;
try {
future = client.set(key, 60 * 60 * 24, value);
} catch (IllegalStateException ise) { // operation queue가 full 상태여서 timeout 내에 Operation을 등록하지 못한 경우
System.out.println("illegal state exception");
}
if (future != null) {
try {
boolean result = future.get(1000, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
f.cancel(true);
System.out.println("timeout exception");
} catch (ExecutionException e) {
f.cancel(true);
System.out.println("execution exception");
} catch (InterruptedException e) {
f.cancel(true);
System.out.println("interrupted exception");
}
}Expiretime 설정
Operation timeout 설정
캐릭터 인코딩
시스템 캐릭터 인코딩 확인 (Linux 기준)
시스템 캐릭터 인코딩 변경 (Linux 기준)
JVM 인코딩 변경
Last updated