Configs2026年7月16日·1 分钟阅读

NutsDB — Fast Embeddable Key-Value Store in Pure Go

A simple, fast, embeddable, and persistent key/value store written in pure Go with support for lists, sets, sorted sets, and fully serializable transactions.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
NutsDB
先审查命令
npx -y tokrepo@latest install 5180acdf-8156-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

NutsDB is an embeddable, persistent key/value store written in pure Go. It supports multiple data structures including strings, lists, sets, and sorted sets, all within a single-file database with ACID transaction guarantees. It is designed for applications that need a fast embedded database without running a separate server process.

What NutsDB Does

  • Stores key/value pairs with optional TTL expiration
  • Supports list, set, and sorted set data structures within buckets
  • Provides fully serializable ACID transactions
  • Persists data using an append-only log with automatic compaction
  • Offers prefix and range scan operations for ordered iteration

Architecture Overview

NutsDB uses a bitcask-inspired append-only write model combined with an in-memory index (B+ tree or hash map) for fast lookups. All writes go to a write-ahead entry log on disk, while the in-memory index maps keys to their on-disk positions. Background merge processes compact old log segments to reclaim space. Transactions use a copy-on-write approach with commit-time conflict detection.

Self-Hosting & Configuration

  • Import as a Go module: go get github.com/nutsdb/nutsdb
  • Open a database by specifying a data directory path
  • Configure segment size, sync strategy, and index type via options
  • Choose between B+ tree index (range scans) or hash map index (point lookups)
  • Set entry-level TTL for automatic expiration of stale data

Key Features

  • Pure Go implementation with zero CGo dependencies
  • Multiple data structures (KV, list, set, sorted set) in a unified API
  • B+ tree index mode enabling efficient prefix and range scans
  • Configurable TTL per entry for cache-like expiration behavior
  • Automatic log segment merging for space reclamation

Comparison with Similar Tools

  • BoltDB/bbolt — B+ tree with page-level MVCC; NutsDB uses a bitcask log with richer data structures (lists, sets)
  • BadgerDB — LSM-tree optimized for SSDs; NutsDB uses an append-only log with simpler compaction
  • LevelDB/RocksDB — C/C++ engines; NutsDB is pure Go with no CGo overhead
  • Redis — in-memory server with similar data structures; NutsDB is an embedded library with disk persistence

FAQ

Q: Does NutsDB support concurrent access? A: Yes, NutsDB supports concurrent reads and serialized writes within a single process using its transaction system.

Q: How does TTL work? A: Each entry can be stored with a TTL in seconds. Expired entries are cleaned up during reads and background merge operations.

Q: What index modes are available? A: NutsDB offers B+ tree index mode for range scans and prefix queries, and hash map index mode for faster point lookups.

Q: Is NutsDB suitable for production use? A: NutsDB is used in production by several projects. It works well for embedded storage scenarios where a separate database server is not desired.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产