chore: 调整拼写错误单词Seacher->Searcher
This commit is contained in:
parent
b7f2ffa285
commit
a3d1ba5d30
|
|
@ -17,14 +17,14 @@
|
||||||
// 1, 创建 v4 的配置:指定缓存策略和 v4 的 xdb 文件路径
|
// 1, 创建 v4 的配置:指定缓存策略和 v4 的 xdb 文件路径
|
||||||
final Config v4Config = Config.custom()
|
final Config v4Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache) // 指定缓存策略: NoCache / VIndexCache / BufferCache
|
.setCachePolicy(Config.VIndexCache) // 指定缓存策略: NoCache / VIndexCache / BufferCache
|
||||||
.setSeachers(15) // 设置初始化的查询器数量
|
.setSearchers(15) // 设置初始化的查询器数量
|
||||||
.setXdbPath("ip2region v4 xdb path") // 设置 v4 xdb 文件的路径
|
.setXdbPath("ip2region v4 xdb path") // 设置 v4 xdb 文件的路径
|
||||||
.asV4(); // 指定为 v4 配置
|
.asV4(); // 指定为 v4 配置
|
||||||
|
|
||||||
// 2, 创建 v6 的配置:指定缓存策略和 v6 的 xdb 文件路径
|
// 2, 创建 v6 的配置:指定缓存策略和 v6 的 xdb 文件路径
|
||||||
final Config v6Config = Config.custom()
|
final Config v6Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache) // 指定缓存策略: NoCache / VIndexCache / BufferCache
|
.setCachePolicy(Config.VIndexCache) // 指定缓存策略: NoCache / VIndexCache / BufferCache
|
||||||
.setSeachers(15) // 设置初始化的查询器数量
|
.setSearchers(15) // 设置初始化的查询器数量
|
||||||
.setXdbPath("ip2region v6 xdb path") // 设置 v6 xdb 文件的路径
|
.setXdbPath("ip2region v6 xdb path") // 设置 v6 xdb 文件的路径
|
||||||
.asV6(); // 指定为 v6 配置
|
.asV6(); // 指定为 v6 配置
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class ConfigBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigBuilder setSeachers(int searchers) {
|
public ConfigBuilder setSearchers(int searchers) {
|
||||||
this.searchers = searchers;
|
this.searchers = searchers;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -80,4 +80,4 @@ public class ConfigBuilder {
|
||||||
return build(Version.IPv6);
|
return build(Version.IPv6);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public class ConfigTest {
|
||||||
final Config v4Config = Config.custom()
|
final Config v4Config = Config.custom()
|
||||||
.setCachePolicy(Config.BufferCache)
|
.setCachePolicy(Config.BufferCache)
|
||||||
.setXdbPath(getDataPath("ip2region_v4.xdb"))
|
.setXdbPath(getDataPath("ip2region_v4.xdb"))
|
||||||
.setSeachers(20)
|
.setSearchers(20)
|
||||||
.asV4();
|
.asV4();
|
||||||
log.debugf("builded config: %s", v4Config);
|
log.debugf("builded config: %s", v4Config);
|
||||||
}
|
}
|
||||||
|
|
@ -35,8 +35,8 @@ public class ConfigTest {
|
||||||
final Config v4Config = Config.custom()
|
final Config v4Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache)
|
.setCachePolicy(Config.VIndexCache)
|
||||||
.setXdbPath(getDataPath("ip2region_v6.xdb"))
|
.setXdbPath(getDataPath("ip2region_v6.xdb"))
|
||||||
.setSeachers(20)
|
.setSearchers(20)
|
||||||
.asV6();
|
.asV6();
|
||||||
log.debugf("builded config: %s", v4Config);
|
log.debugf("builded config: %s", v4Config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ public class Ip2RegionTest {
|
||||||
public void TestConfigCreate() throws IOException, XdbException, InetAddressException, InterruptedException {
|
public void TestConfigCreate() throws IOException, XdbException, InetAddressException, InterruptedException {
|
||||||
final Config v4Config = Config.custom()
|
final Config v4Config = Config.custom()
|
||||||
.setCachePolicy(Config.NoCache)
|
.setCachePolicy(Config.NoCache)
|
||||||
.setSeachers(10)
|
.setSearchers(10)
|
||||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
||||||
.asV4();
|
.asV4();
|
||||||
|
|
||||||
final Config v6Config = Config.custom()
|
final Config v6Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache)
|
.setCachePolicy(Config.VIndexCache)
|
||||||
.setSeachers(10)
|
.setSearchers(10)
|
||||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
||||||
.asV6();
|
.asV6();
|
||||||
|
|
||||||
|
|
@ -92,13 +92,13 @@ public class Ip2RegionTest {
|
||||||
public void TestConcurrentCall() throws IOException, XdbException, InetAddressException, InterruptedException {
|
public void TestConcurrentCall() throws IOException, XdbException, InetAddressException, InterruptedException {
|
||||||
final Config v4Config = Config.custom()
|
final Config v4Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache)
|
.setCachePolicy(Config.VIndexCache)
|
||||||
.setSeachers(15)
|
.setSearchers(15)
|
||||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
||||||
.asV4();
|
.asV4();
|
||||||
|
|
||||||
final Config v6Config = Config.custom()
|
final Config v6Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache)
|
.setCachePolicy(Config.VIndexCache)
|
||||||
.setSeachers(15)
|
.setSearchers(15)
|
||||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
||||||
.asV6();
|
.asV6();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ public class SearcherPoolTest {
|
||||||
private static final Log log = Log.getLogger(SearcherPoolTest.class).setLevel(Log.DEBUG);
|
private static final Log log = Log.getLogger(SearcherPoolTest.class).setLevel(Log.DEBUG);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testV4SeacherPool() throws Exception {
|
public void testV4SearcherPool() throws Exception {
|
||||||
final Config v4Config = Config.custom()
|
final Config v4Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache)
|
.setCachePolicy(Config.VIndexCache)
|
||||||
.setSeachers(5)
|
.setSearchers(5)
|
||||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
||||||
.asV4();
|
.asV4();
|
||||||
|
|
||||||
|
|
||||||
final String ipStr = "58.250.36.41";
|
final String ipStr = "58.250.36.41";
|
||||||
final SearcherPool v4Pool = SearcherPool.create(v4Config);
|
final SearcherPool v4Pool = SearcherPool.create(v4Config);
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
|
|
@ -33,14 +33,14 @@ public class SearcherPoolTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testV6SeacherPool() throws Exception {
|
public void testV6SearcherPool() throws Exception {
|
||||||
final Config v6Config = Config.custom()
|
final Config v6Config = Config.custom()
|
||||||
.setCachePolicy(Config.VIndexCache)
|
.setCachePolicy(Config.VIndexCache)
|
||||||
.setSeachers(5)
|
.setSearchers(5)
|
||||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
||||||
.asV6();
|
.asV6();
|
||||||
|
|
||||||
|
|
||||||
final String ipStr = "240e:3b7:3272:d8d0:db09:c067:8d59:539e";
|
final String ipStr = "240e:3b7:3272:d8d0:db09:c067:8d59:539e";
|
||||||
final SearcherPool v4Pool = SearcherPool.create(v6Config);
|
final SearcherPool v4Pool = SearcherPool.create(v6Config);
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue