SearchCache.java
962 Bytes
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
37
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;
}
}