Skip to content

CoreyKaylor/Lightning.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/