LMDB

These are Ruby bindings OpenLDAP's excellent Lightning Memory-Mapped Database (LMDB).

Installation

Install via RubyGems:

$ gem install lmdb

If you want to force the bundled LMDB over your system version (assuming one is present, along with headers):

$ gem install lmdb -- --vendor-lmdb

API

require 'lmdb'

env = LMDB.new(path)

maindb = env.database
subdb = env.database('subdb', create: true)

maindb['key'] = 'value'

env.transaction do
  maindb['key'] = 'value'
  subdb['key'] = 'value'
end

env.close

Moneta

If you want to have a simpler interface to LMDB databases please consider using Moneta. The Moneta gem provides an LMDB adapter which uses this gem.

License (MIT)

Copyright