mirror of
https://github.com/netfun2000/ip2region.git
synced 2026-02-27 09:44:31 +08:00
feat:support for concurrent file-based queries
This commit is contained in:
22
binding/csharp/IP2Region.Net/Internal/FileCacheStrategy.cs
Normal file
22
binding/csharp/IP2Region.Net/Internal/FileCacheStrategy.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2023 The Ip2Region Authors. All rights reserved.
|
||||
// Use of this source code is governed by a Apache2.0-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// @Author Alan <lzh.shap@gmail.com>
|
||||
// @Date 2023/07/25
|
||||
|
||||
using IP2Region.Net.Internal.Abstractions;
|
||||
|
||||
namespace IP2Region.Net.Internal;
|
||||
|
||||
internal class FileCacheStrategy : AbstractCacheStrategy
|
||||
{
|
||||
public FileCacheStrategy(string xdbPath) : base(xdbPath)
|
||||
{
|
||||
}
|
||||
|
||||
internal override ReadOnlyMemory<byte> GetVectorIndex(uint ip)
|
||||
{
|
||||
var idx = GetVectorIndexStartPos(ip);
|
||||
return GetData(HeaderInfoLength + idx, VectorIndexSize);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user