cachefactory.java

来自「struts+hibernate在线考试系统exam」· Java 代码 · 共 33 行

JAVA
33
字号
package cn.hxex.exam.cache;

import cn.hxex.exam.config.CacheConfig;
import cn.hxex.exam.config.ExamConfigUtil;
import cn.hxex.exam.util.HxexClassUtils;

/**
 * The Cache Factory
 * 
 * @author galaxy
 * 
 */
public class CacheFactory
{
	/**
	 * Get the Cache instance
	 * 
	 * @return the cache instance
	 */
	public static Cache getCache()
	{
		// 得到缓存对象的配置信息
		CacheConfig cacheconfig = ExamConfigUtil.getCacheConfig();
		// 得到缓存对象的实例
		Cache cache = HxexClassUtils.getInstance(Cache.class, cacheconfig
				.getType());
		// 缓存对象初始化
		cache.initialize(cacheconfig.getProperties());

		return cache;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?