guava.cache
com.google.common.cache.CacheBuilder;
private LoadingCache<String, Object> blackListCache = CacheBuilder.newBuilder().maximumSize(100).expireAfterWrite(120, TimeUnit.SECONDS).refreshAfterWrite(60, TimeUnit.SECONDS).build(new CacheLoader<String, Object>(){
@Override
public Object load(String key) throws Exception
{
if("blackList".equals(key)){
return blacklistDao.getBlacklistByModule(BLACKLIST_MODULE);
}
return null;
}
});