문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 다음 판 | 이전 판 | ||
|
java:simple-spring-memcached [2013/10/07 21:58] kwon37xi 새로 만듦 |
java:simple-spring-memcached [2015/04/17 16:58] (현재) kwon37xi [주의] |
||
|---|---|---|---|
| 줄 4: | 줄 4: | ||
| * [[: | * [[: | ||
| * Spring Cache Abstraction도 함께 지원해준다. | * Spring Cache Abstraction도 함께 지원해준다. | ||
| + | |||
| + | ===== 설정 ===== | ||
| + | * '' | ||
| + | |||
| + | ===== Cache Name을 key Prefix로 사용하기 ===== | ||
| + | * SSM은 하나의 Memcached 서버군에서 여러 Cache Name을 사용할 경우에도 기본적으로 CacheName을 Key의 prefix로 붙이지 않아서, 여러 CacheName에서 동일한 Cache Key를 사용할 경우 키 충돌이 발생할 수 있다. | ||
| + | * 해당 문제는 특히 [[springframework: | ||
| + | * [[https:// | ||
| + | @Bean | ||
| + | public CacheConfiguration coupangCacheConfiguration() { | ||
| + | CacheConfiguration cacheConfiguration = new CacheConfiguration(); | ||
| + | cacheConfiguration.setConsistentHashing(true); | ||
| + | cacheConfiguration.setUseBinaryProtocol(true); | ||
| + | cacheConfiguration.setOperationTimeout(operationTimeout); | ||
| + | |||
| + | // Cache Name Key Prefix 부분 | ||
| + | cacheConfiguration.setUseNameAsKeyPrefix(true); | ||
| + | cacheConfiguration.setKeyPrefixSeparator(":" | ||
| + | return cacheConfiguration; | ||
| + | } | ||
| + | </ | ||
| + | * Memcached 버전에 따라 Key 문자열에 ''#'' | ||
| + | |||
| + | ===== 임시 Cache 무력화 ===== | ||
| + | * '' | ||
| + | -Dssm.cache.disable=true | ||
| + | </ | ||
| + | |||
| + | ===== 주의 ===== | ||
| + | * Annotation은 Class 레벨에 붙이도록 한다. Interface에 어노테이션 하는 것은 작동하지 않는다. | ||
| + | * '' | ||
| + | * 최소한 한 개의 '' | ||
| + | * '' | ||