本文整理汇总了Java中com.maxmind.db.CHMCache类的典型用法代码示例。如果您正苦于以下问题:Java CHMCache类的具体用法?Java CHMCache怎么用?Java CHMCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CHMCache类属于com.maxmind.db包,在下文中一共展示了CHMCache类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setConf
import com.maxmind.db.CHMCache; //导入依赖的package包/类
@Override
public void setConf(AbstractConfig config) {
this.config = (GeoIpOperationConfig) config;
AmazonS3Client client = this.s3Factory.newInstance();
AmazonS3URI uri = new AmazonS3URI(this.config.getGeoLiteDb());
GetObjectRequest req = new GetObjectRequest(uri.getBucket(), uri.getKey());
S3Object obj = client.getObject(req);
try {
this.databaseReader =
new DatabaseReader.Builder(obj.getObjectContent()).withCache(new CHMCache()).build();
} catch (IOException e) {
throw new ConfigurationException("Unable to read " + this.config.getGeoLiteDb(), e);
}
}
开发者ID:Nextdoor,项目名称:bender,代码行数:17,代码来源:GeoIpOperationFactory.java
示例2: PerformanceLineAnalyzer
import com.maxmind.db.CHMCache; //导入依赖的package包/类
/**
*
*/
public PerformanceLineAnalyzer(LogParserConfiguration logParserConfiguration) throws IOException {
super(new File(logParserConfiguration.getOutputDirectory(), LINE_ANALYZER_KEY + "-details"),
new File(logParserConfiguration.getOutputDirectory(), LINE_ANALYZER_KEY + "-summary"),
logParserConfiguration.getLogEntryWriterFactories());
if (logParserConfiguration.getPatternList() != null && logParserConfiguration.getPatternList().size() > 0) {
linePattern = Pattern.compile((String)logParserConfiguration.getPatternList().get(0));
} else {
linePattern = Pattern.compile(logParserConfiguration.getPerfMatchingPattern());
}
dateFormat = new SimpleDateFormat(logParserConfiguration.getDateFormatString());
contextMapping = logParserConfiguration.getContextMapping();
servletMapping = logParserConfiguration.getServletMapping();
InputStream maxMindDBStream = this.getClass().getResourceAsStream("/maxmind-db/GeoLite2-City.mmdb");
if (maxMindDBStream != null) {
databaseReader = new DatabaseReader.Builder(maxMindDBStream).withCache(new CHMCache()).build();
}
}
开发者ID:Jahia,项目名称:jahia-loganalyzer,代码行数:22,代码来源:PerformanceLineAnalyzer.java
示例3: MaxmindDatabaseGeoLocationService
import com.maxmind.db.CHMCache; //导入依赖的package包/类
public MaxmindDatabaseGeoLocationService(final MaxmindProperties properties) {
try {
if (properties.getCityDatabase().exists()) {
this.cityDatabaseReader = new DatabaseReader.Builder(properties.getCityDatabase().getFile())
.withCache(new CHMCache()).build();
}
if (properties.getCountryDatabase().exists()) {
this.countryDatabaseReader = new DatabaseReader.Builder(properties.getCountryDatabase().getFile())
.withCache(new CHMCache()).build();
}
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:16,代码来源:MaxmindDatabaseGeoLocationService.java
示例4: fromFile
import com.maxmind.db.CHMCache; //导入依赖的package包/类
private static DatabaseReader fromFile(File path) {
try {
LOGGER.info("Opening GeoIP database from file {}", path);
return new DatabaseReader.Builder(path).withCache(new CHMCache()).build();
} catch (IOException e) {
throw new IllegalStateException("Failed to open Geo database file" + path, e);
}
}
开发者ID:sonyxperiadev,项目名称:lumber-mill,代码行数:9,代码来源:GeoIP.java
示例5: fromClasspath
import com.maxmind.db.CHMCache; //导入依赖的package包/类
private static DatabaseReader fromClasspath() {
try {
LOGGER.info("Trying to open database GeoLite2-City.mmdb from classpath");
URL resource = Thread.currentThread().getContextClassLoader().getResource("GeoLite2-City.mmdb");
return new DatabaseReader.Builder(resource.openStream())
.withCache(new CHMCache()).build();
} catch (IOException e) {
throw new IllegalStateException("Failed to open GeoLite2-City.mmdb database in classpath", e);
}
}
开发者ID:sonyxperiadev,项目名称:lumber-mill,代码行数:11,代码来源:GeoIP.java
示例6: main
import com.maxmind.db.CHMCache; //导入依赖的package包/类
public static void main(String[] args) throws IOException, InvalidDatabaseException {
File file = new File(args.length > 0 ? args[0] : "GeoLite2-City.mmdb");
System.out.println("No caching");
loop("Warming up", file, WARMUPS, NoCache.getInstance());
loop("Benchmarking", file, BENCHMARKS, NoCache.getInstance());
System.out.println("With caching");
loop("Warming up", file, WARMUPS, new CHMCache());
loop("Benchmarking", file, BENCHMARKS, new CHMCache());
}
开发者ID:maxmind,项目名称:MaxMind-DB-Reader-java,代码行数:11,代码来源:Benchmark.java
注:本文中的com.maxmind.db.CHMCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论