代码拉取完成,页面将自动刷新
.NET client library for IP2Region
Install the package with NuGet
Install-Package IP2Region.Net
using IP2Region.Net.Abstractions;
using IP2Region.Net.XDB;
ISearcher searcher = new Searcher(CachePolicy , "your xdb file path");
Cache Policy | Description | Thread Safe |
---|---|---|
CachePolicy.Content | Cache the entire xdb data. |
Yes |
CachePolicy.VectorIndex | Cache vecotorIndex to speed up queries and reduce system io pressure by reducing one fixed IO operation. |
Yes |
CachePolicy.File | Completely file-based queries | Yes |
Generate using maker, or download pre-generated xdb files
services.AddSingleton<ISearcher>(new Searcher(CachePolicy , "your xdb file path"));
BenchmarkDotNet=v0.13.2, OS=macOS 13.4.1 (c) (22F770820d) [Darwin 22.5.0]
Apple M1, 1 CPU, 8 logical and 8 physical cores
.NET SDK=7.0.306
[Host] : .NET 6.0.20 (6.0.2023.32017), Arm64 RyuJIT AdvSIMD
DefaultJob : .NET 6.0.20 (6.0.2023.32017), Arm64 RyuJIT AdvSIMD
Method | Mean | Error | StdDev |
---|---|---|---|
CachePolicy_Content | 155.7 ns | 0.46 ns | 0.39 ns |
CachePolicy_File | 2,186.8 ns | 34.27 ns | 32.06 ns |
CachePolicy_VectorIndex | 1,570.3 ns | 27.53 ns | 22.99 ns |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。