cn.sylinx.hbatis.plugin.cache.GuavaCachePlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbatis-core Show documentation
Show all versions of hbatis-core Show documentation
hbatis is a simple orm framework
package cn.sylinx.hbatis.plugin.cache;
import cn.sylinx.hbatis.db.cache.CacheKitManager;
import cn.sylinx.hbatis.log.GLog;
import cn.sylinx.hbatis.plugin.IPlugin;
public class GuavaCachePlugin implements IPlugin {
private GuavaCacheConfig guavaCacheConfig;
public GuavaCachePlugin() {
this(new GuavaCacheConfig());
}
public GuavaCachePlugin(GuavaCacheConfig guavaCacheConfig) {
this.guavaCacheConfig = guavaCacheConfig;
}
@Override
public boolean start(Object... objects) {
GLog.info("guava cache plugin starting..");
if (guavaCacheConfig == null) {
guavaCacheConfig = new GuavaCacheConfig();
}
CacheKitManager.set(new GuavaCacheKit(guavaCacheConfig));
GLog.info("guava cache plugin started");
return true;
}
@Override
public boolean stop() {
return true;
}
}