Skip to content

Introduction

Redis-compatible key-value store on SQLite in Rust.

from redlite import Redlite
db = Redlite("app.db")
db.set("user:1", "Alice")
print(db.get("user:1")) # "Alice"
db.hset("profile:1", {"name": "Alice", "score": "100"})
print(db.hgetall("profile:1"))

Redis has operational overhead—separate process, memory constraints, replication complexity. For embedded systems, mobile apps, or simple services, you just need a fast key-value store that persists. Redlite gives you that: Redis semantics on SQLite, durable by default, single-file backup, compatible with existing clients.

ModeStorageUse Case
EmbeddedMemoryTesting, ephemeral caches
EmbeddedFileSingle-process apps, mobile
ServerMemoryEphemeral shared cache
ServerFileMulti-client persistent cache
  • Embedded — Native bindings (Python, TypeScript, Elixir) or FFI. No network overhead.
  • Server — TCP server speaking Redis protocol. Use redis-cli or any Redis client.
  • Redis types → SQLite tables (hashes → rows, sorted sets → scores, lists → gap-based positioning)
  • Writes persist immediately (WAL mode)
  • Extras: HISTORY (time-travel), VACUUM, full-text search, vectors, geo
ModeGETSETMixed
Embedded (file)200k+ ops/sec45k+ ops/sec90k ops/sec

Benchmarks: macOS M1, 64MB cache. See redlite-bench for details.

Durability: All writes persisted immediately (SQLite WAL mode). Memory: Configurable page cache (default 64MB).

Performance notes:

  • History tracking adds write overhead (extra row per mutation)
  • FTS/vector indexing adds write latency
  • Geo features require computation per query
Feature
Strings, Hashes, Lists, Sets, Sorted Sets, Streams
Transactions (MULTI/EXEC/WATCH)
Pub/Sub (server), Blocking Reads (polling/async)
Full-Text Search, JSON, Vectors, Geospatial
History Tracking, Memory/Disk Eviction
  • Clustering/replication (use Litestream for backups)
  • Lua scripting

Installation · Quick Start