본문 바로가기

Programming!

Spring annotations

http://code.google.com/p/ehcache-spring-annotations/

applicationContext.xml
...
 xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
 xsi:schemaLocation="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring
      http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd"
...



<!-- Cache dependencies -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.0.1</version>
</dependency>
<dependency> 
<groupId>com.googlecode.ehcache-spring-annotations</groupId> 
<artifactId>ehcache-spring-annotations</artifactId> 
<version>1.1.2</version> 
</dependency>

생성시
...
@Cacheable(cacheName="archeage.quest.MainQuest", keyGenerator=@KeyGenerator(name="StringCacheKeyGenerator"))
public MainQuest findMainQuest(QuestParameter questParameter) {
...

수정시
...
@TriggersRemove(cacheName="infoCache", keyGene....)
public void updateMainQuest(..) {
...


기존에 Method Cache를 사용하기 위해서 별도의 래핑 클래스를 생성..어찌어찌 했었는데 나름 괘안은 듯.