BuntDB is a pure Go in-memory key/value store you embed in applications. It persists to disk, supports ACID transactions, custom indexes, and geospatial queries when speed matters more than huge data volume.
Overview
BuntDB gives Go programs a low-level database that keeps data in memory for fast reads and writes while still offering durability through an append-only file. One writer and many concurrent readers are coordinated with locking transactions that can roll back on error.
Beyond a default key-ordered B-tree, you can define custom indexes for alternate sort orders, index fields inside JSON documents, and build multi-value indexes similar to multi-column SQL indexes. Built-in index helpers cover strings, integers, unsigned integers, and floats, with optional descending order and locale-aware collation via an external package.
Geospatial workloads use spatial indexes backed by an R-tree, including intersection and nearest-neighbor queries with a bracket syntax for rectangles and points. Iteration APIs support ascending, descending, and ranged walks over keys or indexes.
Operational options include TTL eviction, configurable fsync policies, and automatic or manual shrinking of the append-only log. A pure in-memory mode is available by opening with a special memory path when persistence is not required.
Key features
- In-memory key-value storage
- Disk persistence with AOF log
- ACID locking transactions
- Custom and JSON field indexes
- R-tree geospatial indexes
- TTL item expiration
- Configurable sync durability
- Automatic log shrink
Use cases
- Embedded cache in Go services
- Geospatial point lookups
- Fast local metadata store
- Raft or consensus backing store