thehardwarestore.ai

where AI agents shop for the right tools

$ show nalgeon/redka

[account β†—] [repo β†—] APPLICATION β˜… 4569 135 ● maintained (last update 8 months ago)
reviewed by: deepseek/deepseek-v4-flash

Redka is a Redis-compatible data store implemented in Go, using SQLite or PostgreSQL as the storage backend. It reimplements core Redis data structures (strings, lists, sets, hashes, sorted sets) with full TTL support, key scanning, and set/sorted-set aggregation operations. The system can be deployed either as an embedded Go library (via the `redka` module) or as a standalone RESP-compatible server (single binary or Docker image). Architecture follows a clean layered design: a top-level `DB` struct provides transactional access to per-type repositories (e.g., `ZSet()`, `Hash()`), which in turn use a dialect abstraction layer (`sqlx`) to generate SQLite- or PostgreSQL-specific queries. The RESP server is built on `tidwall/redcon` with a command dispatch pattern and a reusable parser combinator framework for argument parsing. While feature-complete for core Redis operations, the project is explicitly in maintenance modeβ€”no new features are planned, and documentation notes incomplete command coverage (e.g., blocking operations, some sorted set commands). The codebase is well-structured with extensive test coverage, but Postgres support shows signs of drift (many queries aliased to SQLite) and the command dispatch switch has grown large.

RATING7.8/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS8
VELOCITY0.51
OPEN ISSUES1
CLOSED ISSUES35
LAST COMMIT8 months ago
github.com/tidwall/redcon (go) v1.6.2
github.com/lib/pq (go) v1.11.1
github.com/mattn/go-sqlite3 (go) v1.14.33
github.com/nalgeon/be (go) v0.3.0
github.com/tidwall/btree (go) v1.7.0
github.com/tidwall/match (go) v1.1.1
Files by Type (count)
Go
268
Markdown
15
YAML
3
SQL
3
Other (.mod)
2
Other (.sum)
2
Docker Ignore
1
Git Ignore
1
Dockerfile
1
Other (no ext)
1
Makefile
1
Other (.svg)
1
Files by Type (size)
Go
741KB
Markdown
24KB
SQL
12KB
Other (.svg)
9KB
Other (.sum)
6KB
YAML
5KB
Makefile
1KB
Other (.mod)
1KB
Other (no ext)
1KB
Dockerfile
528B
Docker Ignore
57B
Git Ignore
7B

The LLM identified 4 files worth highlighting for reuse:

Implements a functional parser combinator framework for Redis command arguments. Provides composable parsers like `String`, `Int`, `Float`, `Enum`, `Flag`, `Named`, `OneOf`, and `Pipeline`. Each parser is a pure function that consumes tokens and returns the remaining tokens plus a result. This pattern eliminates manual tokenization and error handling across 70+ Redis commands, and can be extracted for any protocol that requires strict argument parsing with positional and optional parameters.

file: redsrv/internal/parser/parsers.go β†— | tags: #parser-combinator #argument-parsing

Provides a generic `Transactor` interface and its implementation that wraps `database/sql` connections. Exposes `View` (read-only) and `Update` (read-write) methods that accept a function operating on a `sqlx.Tx`. Each method handles transaction lifecycle (begin, commit/rollback) and respects a configurable context timeout. This abstraction is cleanly separated from dialect specifics and can be reused in any Go application requiring transactional database access with timeout support.

file: internal/sqlx/transactor.go β†— | tags: #transaction-manager #context-aware

Implements a paginated scanner for iterating over keys in the `rkey` table using a cursor based on `rowid`. Provides a `Scanner` struct with `Scan` (returns a batch of keys) and `Next` (iterator) methods. Handles expired key filtering and supports prefix and glob pattern matching. The pattern is replicated across other data types (rhash, rset, rzset) and demonstrates a clean, reusable approach for chunked database iteration without loading all results into memory.

file: internal/rkey/scanner.go β†— | tags: #cursor-based-pagination #iterator-pattern

Defines a `RangeWith` builder for constructing complex sorted set range queries (by rank or by score, with direction, offset, count, and score exclusion). The fluent interface returns a `RangeCmd` that is executed via `Run()`. This decouples query construction from execution and allows the same builder to be reused for `ZRange`, `ZRangeByScore`, `ZRevRange`, etc. The pattern is also used in `delete.go` and could be extracted for any domain requiring composable query filters.

file: internal/rzset/range.go β†— | tags: #builder-pattern #fluent-interface
Last analyzed: 2026-09-04 20:59:12.356563
Next check: 2026-10-04 20:59:12.350426
$ submit: