NScript.LiteDB.RocksDBExtention
6.0.3
dotnet add package NScript.LiteDB.RocksDBExtention --version 6.0.3
NuGet\Install-Package NScript.LiteDB.RocksDBExtention -Version 6.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NScript.LiteDB.RocksDBExtention" Version="6.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NScript.LiteDB.RocksDBExtention --version 6.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NScript.LiteDB.RocksDBExtention, 6.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NScript.LiteDB.RocksDBExtention as a Cake Addin #addin nuget:?package=NScript.LiteDB.RocksDBExtention&version=6.0.3 // Install NScript.LiteDB.RocksDBExtention as a Cake Tool #tool nuget:?package=NScript.LiteDB.RocksDBExtention&version=6.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NScript.LiteDB.RocksDBExtention
本库是 NScript.LiteDB.Utils
的扩展。LiteDB 存大量的文件数据时,性能比较底下,本扩展在 RocksDB 之上,提供了 RocksDBFileStorageService
类,实现了接口 RocksDBFileStorageService
,提供了和 NScript.LiteDB.Utils
中 FileStorageService
相似的方式来存储文件。
可以指定存储的根目录。IFileStorageService 将在根目录下,根据文件名称的前 8 个字符,寻找相应的桶,进行相关的操作。通过 NextFileId 方法可以生成 [8字符日期+UUID+扩展名] 格式的文件名,这样存储时将按照日期分片保存。
IFileStorageService
接口定义为:
public interface IFileStorageService
{
/// <summary>
/// 生成下一个文件的 Id。文件名称为 8字符日期+UUID+扩展名
/// </summary>
/// <param name="fileExtention"></param>
/// <returns></returns>
public string NextFileId(String fileExtention = "");
/// <summary>
/// 删除文件
/// </summary>
/// <param name="fileId"></param>
/// <returns></returns>
public bool Delete(String fileId);
/// <summary>
/// 保存文件,返回文件 fileId
/// </summary>
/// <param name="data"></param>
/// <param name="fileExtention"></param>
/// <returns></returns>
public String Save(Byte[] data, String fileExtention);
/// <summary>
/// 保存文件到指定 fileId
/// </summary>
/// <param name="fileId"></param>
/// <param name="data"></param>
/// <returns></returns>
public bool Save(String fileId, Byte[] data);
/// <summary>
/// 根据文件Id查找文件
/// </summary>
/// <param name="fileId"></param>
/// <returns></returns>
public byte[]? Find(String fileId);
}
相关操作:
void TestRocksDBFileStorageService(String? dir = null)
{
var storage = new RocksDBFileStorageService();
if (dir != null) storage.BaseDir = dir;
byte[] data = new byte[10];
var fileId = storage.Save(data, ".dat");
Console.WriteLine(fileId);
var item = storage.Find(fileId);
Console.WriteLine(item.Length);
var rtn = storage.Delete(fileId);
Console.WriteLine(rtn);
item = storage.Find(fileId);
if (item == null) Console.WriteLine("Delete OK!");
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- NScript.LiteDB.Utils (>= 6.0.2.1)
- RocksDB (>= 8.11.3.46984)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.