TestCache.java.svn-base 890 Bytes
Newer Older
Kim Gyeongeun committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
package jp.agentec.sinaburocast.cache;

import jp.agentec.sinaburocast.entity.Test;
import jp.agentec.sinaburocast.service.TestService;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.seasar.framework.container.annotation.tiger.Component;
import org.seasar.framework.container.annotation.tiger.InitMethod;
import org.seasar.framework.container.annotation.tiger.InstanceType;

/**
 * testキャッシュ用クラス
 *
 *
 * @author tsukada
 *
 */
@Component(instance=InstanceType.SINGLETON)
public class TestCache extends AbstractCache<Test> {
	private final Log logger= LogFactory.getLog(getClass());

	public TestService testService;
	
	@InitMethod
	public void init() {
		setCache("test_cache");
	}

	@Override
	protected Test findRawValue(Object... key) {
		Integer testId = (Integer)key[0];
		return testService.findById(testId);
	}

}