사용자 도구

사이트 도구


java:simple-spring-memcached

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
java:simple-spring-memcached [2014/02/03 10:54]
kwon37xi [Cache Name을 key Prefix로 사용하기]
java:simple-spring-memcached [2015/04/17 16:58] (현재)
kwon37xi [주의]
줄 4: 줄 4:
   * [[:memcached|memcached]]의 Multi Get 기능을 Annotation으로 지원해준다.   * [[:memcached|memcached]]의 Multi Get 기능을 Annotation으로 지원해준다.
   * Spring Cache Abstraction도 함께 지원해준다.   * Spring Cache Abstraction도 함께 지원해준다.
 +
 +===== 설정 =====
 +  * ''@EnableAspectJAutoProxy'' 혹은 XML의 경우 ''<aop:aspectj-autoproxy />''가 필수적으로 돼 있어야 한다.
  
 ===== Cache Name을 key Prefix로 사용하기 ===== ===== Cache Name을 key Prefix로 사용하기 =====
줄 15: 줄 18:
     cacheConfiguration.setUseBinaryProtocol(true);     cacheConfiguration.setUseBinaryProtocol(true);
     cacheConfiguration.setOperationTimeout(operationTimeout);     cacheConfiguration.setOperationTimeout(operationTimeout);
 +
 +    // Cache Name Key Prefix 부분
     cacheConfiguration.setUseNameAsKeyPrefix(true);     cacheConfiguration.setUseNameAsKeyPrefix(true);
 +    cacheConfiguration.setKeyPrefixSeparator(":");
     return cacheConfiguration;     return cacheConfiguration;
 } }
 +</code>
 +  * Memcached 버전에 따라 Key 문자열에 ''#''이 오는 것을 허용하지 않는 듯 하다.
 +
 +===== 임시 Cache 무력화 =====
 +  * ''ssm.cache.disable=true'' System Property 지정을 통해 캐시를 임시로 무력화할 수 있다.<code>
 +-Dssm.cache.disable=true
 </code> </code>
  
줄 24: 줄 36:
   * ''com.google.code.ssm.CacheFactory'' 객체 로딩이 ''<import resource="classpath:simplesm-context.xml" />'' 보다 먼저 이뤄져야 한다.   * ''com.google.code.ssm.CacheFactory'' 객체 로딩이 ''<import resource="classpath:simplesm-context.xml" />'' 보다 먼저 이뤄져야 한다.
   * 최소한 한 개의 ''default''라는 이름의 캐시가 존재해야 한다. 그렇지 않으면 매번 **@CacheName** 어노테이션으로 캐시 이름을 지정해줘야 한다.   * 최소한 한 개의 ''default''라는 이름의 캐시가 존재해야 한다. 그렇지 않으면 매번 **@CacheName** 어노테이션으로 캐시 이름을 지정해줘야 한다.
 +  * ''@CacheKeyMethod'' 사용시 ''@CacheKey''뿐만 아니라 ''equals/hashCode'' 등을 통한 값 비교도 행해진다. 따라서 올바른 ''equals/hashCode''도 생성해 두어야 한다.
java/simple-spring-memcached.1391392469.txt.gz · 마지막으로 수정됨: 2014/02/03 10:54 저자 kwon37xi