Tag Archives: ehcache

[자작] MyBatis EHCache 를 필요에 따라 statement 별로 제거하기

By | 4월 29, 2020

import java.util.List; import org.apache.ibatis.cache.CacheKey; import lombok.extern.slf4j.Slf4j; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; /** * MyBatis EHCache 관련 유틸 클래스 * * – mapperId + statementId 에 대하여 exactly equals 가 아니라 contains 임에 주의 * * @author STEVE */ @Slf4j public class MyBatisCacheUtil { /** * MyBatis 쿼리 캐시 제거 * * @param mapperId (e.g. “com.example.repository.UserRepository”) *… Read More »

MyBatis에 EHCache 적용하기

By | 4월 28, 2020

1. pom.xml <dependency> <groupId>org.mybatis.caches</groupId> <artifactId>mybatis-ehcache</artifactId> <version>1.2.1</version> </dependency>   2. MyBatis 각 mapper xml <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE mapper PUBLIC “-//mybatis.org//DTD Mapper 3.0//EN” “http://mybatis.org/dtd/mybatis-3-mapper.dtd”> <mapper namespace=”com.tachyon.api.repository.NewsRepository”> <!– MyBatis ehcache 설정 – http://mybatis.org/ehcache-cache/ –> <cache type=”org.mybatis.caches.ehcache.EhcacheCache”> <!– <cache type=”org.mybatis.caches.ehcache.EhBlockingCache”> –><!– blocking cache를 사용할 경우 –> <property name=”timeToIdleSeconds” value=”3600″/><!–1 hour–> <property name=”timeToLiveSeconds” value=”3600″/><!–1 hour–> <property name=”maxEntriesLocalHeap” value=”1000″/> <property… Read More »

Spring 5 에 ehcache 2 적용 샘플

By | 4월 9, 2020

1.  pom.xml <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <!– Spring 혹은 Terasoluna 에 최신버전이 내장되어 있어서 버전을 지정하지 않았었음. 아마 2.10.x 버전인듯 –> </dependency>   2. ehcache.xml <?xml version=”1.0″ encoding=”UTF-8″?> <ehcache xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”http://ehcache.org/ehcache.xsd” updateCheck=”false”> <!– * 속성 설명 (출처: https://javacan.tistory.com/entry/133) – maxElementsInMemory: 메모리에 저장될 수 있는 객체의 최대 개수 (필수) – eternal: 이 값이 true이면 timeout 관련 설정은… Read More »