IP2Region.Net 1.0.5
IP2Region.Net
IP2Region c# xdb client
Installation
Install the package with NuGet
Install-Package IP2Region.Net
Usage
using IP2Region.Net.XDB;
//use default db and cache whole xdb file
Searcher searcher = new Searcher();
searcher.Search("ipaddress value");
/*
* custom cache policy and xdb file path
* CachePolicy.Content default cache policy , cache whole xdb file , thread safe
* CachePolicy.VectorIndex cache vector index , reduce the number of IO operations , not thread safe!
* CachePolicy.File no cache , not thread safe!
*/
Searcher searcher = new Searcher(CachePolicy.File, "your xdb file path");
ASP.NET Core Usage
services.AddSingleton<ISearcher,Searcher>();
Performance
BenchmarkDotNet=v0.13.2, OS=Windows 11 (10.0.22000.856/21H2)
AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx, 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.400
[Host] : .NET 6.0.8 (6.0.822.36306), X64 RyuJIT AVX2
DefaultJob : .NET 6.0.8 (6.0.822.36306), X64 RyuJIT AVX2
Method | Mean | Error | StdDev |
---|---|---|---|
CachePolicy_Content | 224.6 ns | 4.44 ns | 7.41 ns |
CachePolicy_VectorIndex | 11,648.4 ns | 231.98 ns | 457.91 ns |
Contributing
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.
License
Showing the top 20 packages that depend on IP2Region.Net.
Packages | Downloads |
---|---|
ZhonTai.Admin
中台Admin权限管理接口库
|
3 |
ZhonTai.Admin
中台Admin权限管理接口库
|
4 |
.NET 6.0
- No dependencies.
.NET Standard 2.1
- No dependencies.