// Copyright 2025 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 // @Date 2023/07/25 // Updated by Argo Zhang at 2025/11/21 using IP2Region.Net.Internal.Abstractions; namespace IP2Region.Net.Internal; class ContentCacheStrategy : AbstractCacheStrategy { private readonly ReadOnlyMemory _cacheData; public ContentCacheStrategy(string xdbPath) : base(xdbPath) { _cacheData = base.GetData(0, (int)XdbFileStream.Length); XdbFileStream.Close(); XdbFileStream.Dispose(); } public override ReadOnlyMemory GetData(long offset = 0, int length = 0) => _cacheData.Slice((int)offset, length); }