Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.04 KB

README.md

File metadata and controls

35 lines (26 loc) · 1.04 KB

Lightning.NET

.NET Core Tests

.NET library for OpenLDAP's LMDB key-value store.

The API is easy to use and extremely fast.

using System.Text;
using LightningDB;

using var env = new LightningEnvironment("pathtofolder");
env.Open();

using (var tx = env.BeginTransaction())
using (var db = tx.OpenDatabase(configuration: new DatabaseConfiguration { Flags = DatabaseOpenFlags.Create }))
{
    tx.Put(db, "hello"u8.ToArray(), "world"u8.ToArray());
    tx.Commit();
}
using (var tx = env.BeginTransaction(TransactionBeginFlags.ReadOnly))
using (var db = tx.OpenDatabase())
{
    var (resultCode, key, value) = tx.Get(db, "hello"u8.ToArray());
    Console.WriteLine($"{Encoding.UTF8.GetString(key.AsSpan())} {Encoding.UTF8.GetString(value.AsSpan())}");
}

More examples can be found in the unit tests.

Official LMDB API docs

Library is available from NuGet: https://www.nuget.org/packages/LightningDB/