Skip to content

ok-ul-ch/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 (var env = new LightningEnvironment("pathtofolder"))
{
	env.MaxDatabases = 2;
	env.Open();

	using (var tx = env.BeginTransaction())
	using (var db = tx.OpenDatabase("custom", new DatabaseConfiguration { Flags = DatabaseOpenFlags.Create }))
	{
		tx.Put(db, Encoding.UTF8.GetBytes("hello"), Encoding.UTF8.GetBytes("world"));
		tx.Commit();
	}
	using (var tx = env.BeginTransaction(TransactionBeginFlags.ReadOnly))
	using (var db = tx.OpenDatabase("custom"))
	{
		var (resultCode, key, value) = tx.Get(db, Encoding.UTF8.GetBytes("hello"));
		Assert.Equal(value.CopyToNewArray(), Encoding.UTF8.GetBytes("world"));
	}
}

More examples can be found in the unit tests.

Official LMDB API docs

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

The library is published under MIT license.

About

.NET library for LMDB key-value store

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%