No description
Find a file
Carlo Capocasa 3d0fc672ca
Merge pull request #7 from greenersharp/reverse-iteration
Added optional reverse parameter to all iterators
2025-06-02 17:57:56 +01:00
docs ref 2.0 docs 2023-05-12 10:54:21 +02:00
tests keep tuple for single name database 2023-05-11 07:28:59 +02:00
.gitignore ignore test binary 2023-04-03 16:54:59 +02:00
CHANGELOG fix using write transactions 2023-05-10 09:43:40 +02:00
docs.rst ref 2.0 docs 2023-05-12 10:54:21 +02:00
LICENSE Initial commit 2022-06-06 01:31:04 +02:00
limdb.nim Added optional reverse parameter to all iterators 2024-12-10 13:27:47 -05:00
limdb.nimble support nim back to 0.20 2023-05-11 00:11:09 +02:00
README.md blurb 2023-05-12 11:01:08 +02:00

LimDB

Fast, in-process key-value store with a table-like interface persisted to disk using lmdb.

Why?

Memory-mapped files are one of the fastest ways to store data but are not safe to access concurrently. Lmdb is a proven and mature to solution to that problem, offering full compliance to ACID3, a common standard for database reliability, while keeping most of the speed.

Leveraging the excellent nim-lmdb interface, LimDB makes a larg-ish sub-set of lmdb features available in an interface familiar to Nim users who have experience with a table.

While programming with LimDB feels like using a table, it is still very much lmdb. Some common boilerplate is automated and LimDB is clever about bundling lmdb's moving parts, but there are no bolted-on bits or obscuring of lmdb's behavior.

Installation

nimble install https://github.com/capocasa/limdb

Simple Usage

Provide LimDB with a local storage directory and then use it like you would use a table. After inserting the element, it's on disk an can be accessed even after the program is restarted, or concurrently by different threads or processes.

import limdb
let db = initDatabase("myDirectory")
db["foo"] = "bar"  # that's it, foo -> bar is now on disk
echo db["foo"]     # prints bar

Now if you comment out the write, you can run the program again and read the value off disk

import limdb
let db = initDatabase("myDirectory")
# db["foo"] = "bar"
echo db["foo"]  # also prints "bar"

That's it. If you just need to quickly save some data, you can stop reading here and start programming.

You can go much deeper though- convenient transactions, read/write derived from code, all Nim data types except ref, a convenient initialization syntaxes to initialize multiple databases and transactions that span them.

API Documentation