import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
private Cache<String, String> transactionSessionMapping = CacheBuilder.newBuilder()
.expireAfterAccess(30, TimeUnit.SECONDS).build();
private static volatile Cache<String, String> cache = CacheBuilder.newBuilder()
.build();
- 如果没有单独查询某一个方法的,这个使用使用的是自己写的getMarkupGroupByGroupIdFromDao
private final LoadingCache<Long,List<MarkupGroup>> markupGroupCache =
CacheBuilder.newBuilder().maximumSize(MAXI_NUM_SIZE).softValues().expireAfterAccess(EXPIRE_AFTER_ACCESS,TimeUnit.MINUTES).concurrencyLevel(CONCURRENCY_LEVEL).
build(new CacheLoader<Long, List<MarkupGroup>>() {
@Override
public List<MarkupGroup> load(Long groupId) throws Exception {
return getMarkupGroupByGroupIdFromDao(groupId);
}
});
网友评论