SearchCache.java 962 Bytes
package com.yoho.search.cache.model;

import com.yoho.search.cache.impls.CacheInterface;

public class SearchCache {
	
	private static final int logPeriodInMinute = 1;// 默认每分钟打印一次日志

	private CacheInterface cacheInterface;// 缓存类型
	private int cacheInMinute = 5;// 缓存时间
	private CacheMatchLogger cacheMatchLogger;

	public SearchCache(String cacheName, CacheInterface cacheInterface, int cacheInMinute) {
		super();
		this.cacheInMinute = cacheInMinute;
		this.cacheInterface = cacheInterface;
		this.cacheMatchLogger = new CacheMatchLogger();
		cacheMatchLogger.init(cacheName, cacheInMinute, logPeriodInMinute);
	}

	public CacheInterface getCache() {
		return cacheInterface;
	}

	public void incTotalCount() {
		cacheMatchLogger.incTotalCount();
	}

	public void incMatchCount() {
		cacheMatchLogger.incMatchCount();
	}

	public int getCacheInMinute() {
		return cacheInMinute;
	}

}