Crystal wrapper around the Lightning Memory-Mapped Database (LMDB).
LMDB is a fast embedded transactional database with the following properties:
- Key/value store.
- Ordered map interface (keys are lexicographically sorted).
- Reader/writers transactions that don't block each other.
- ACID compliant, with nested transactions.
This wrapper tries to add as little overhead as possible, by avoiding copy and allocations whenever possible.
- Install LMDB >= 0.9.23 on your system and makes sure the library can be found by the linker.
- Add the dependency to your
shard.yml
:
dependencies:
lmdb:
github: rumenzu/crystal-lmdb
version: 0.1.0
- Run
shards install
require "lmdb"
LMDB.open("./tmp/simpledb") do |env|
env.transaction do
env.open_db do |db|
db.put('a', 'a'.ord)
db.put('b', 'b'.ord)
db.put('c', 'c'.ord)
end
end
end
See also the examples
folder.
- Fork it (https://github.com/your-github-user/crystal-lmdb/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Romain Franceschini - creator and maintainer