...
|
...
|
@@ -14,16 +14,23 @@ import java.util.concurrent.TimeUnit; |
|
|
|
|
|
@Component
|
|
|
public class BigdataSimilarSknIndexBuilder extends IIndexBuilder {
|
|
|
|
|
|
@Autowired
|
|
|
private SimilarSknMapper similarSknMapper;
|
|
|
|
|
|
LoadingCache<String, Integer> cache = CacheBuilder.newBuilder().maximumSize(10000).expireAfterWrite(10, TimeUnit.MINUTES).build(new CacheLoader<String, Integer>() {
|
|
|
@Override
|
|
|
public Integer load(String key) {
|
|
|
return getMaxDateId();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@Override
|
|
|
public void init(){
|
|
|
cache.cleanUp();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int getTotalCount() throws Exception {
|
|
|
return similarSknMapper.selectCount(cache.get("maxDataId"));
|
|
|
}
|
...
|
...
|
@@ -42,4 +49,9 @@ public class BigdataSimilarSknIndexBuilder extends IIndexBuilder { |
|
|
private Integer getMaxDateId() {
|
|
|
return similarSknMapper.selectLatestDateId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void finish(){
|
|
|
cache.cleanUp();
|
|
|
}
|
|
|
} |
...
|
...
|
|