.NET library for LMDB key-value store
C# Other
Latest commit fbf6778 May 30, 2017 @CoreyKaylor CoreyKaylor Bumping version

README.md

Lightning.NET

Join the chat at https://gitter.im/CoreyKaylor/Lightning.NET Linux Build Status Windows Build status

.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 result = tx.Get(db, Encoding.UTF8.GetBytes("hello"));
		Assert.Equal(result, 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.