>_EXECUTIVE SUMMARY
stryke-redis is one of the opt-in connector packages in the stryke ecosystem. Redis / Valkey client for stryke. KV, lists, sets, hashes, sorted sets, pub/sub publish, scan, server admin. Opt-in package — ships as a Rust cdylib that stryke dlopens in-process on first use Redis.
redis Rust crate (sync) with rustls TLS. Single highest-leverage daily-use connector after Postgres / MySQL.
Surface counts are derived from source: 184 public fn Redis::* definitions in lib/Redis.stk, 184 extern "C" fn redis__* exports in src/lib.rs (one per public function, matched against the [ffi] table in stryke.toml), of which 18 are pure helpers that run with no connection, leaving 166 connection-backed Redis commands.
~ARCHITECTURE
In-process cdylib design: the stryke side is a thin .stk wrapper that calls FFI symbols on the dlopen'd library. No subprocess, no pipe — calls return on the same thread that made them.
| Layer | Implementation |
|---|---|
stryke wrappers (lib/*.stk) | Thin Redis.stk wrapper; each public fn serializes its args to JSON and parses the response |
cdylib (libstryke_redis.{dylib,so}) | Single Rust cdylib crate; every public surface fn is an extern "C" fn redis__<verb>(*const c_char) -> *mut c_char |
| Process model | Library is dlopen'd once per stryke session on first use Redis; one redis::Connection per (url, db, auth) tuple cached in OnceCell<Mutex<HashMap>>; lives until the runtime exits |
| Build | Cargo with [lib] crate-type = ["cdylib"]; publish = false; the package itself ships via s pkg install -g . |
| Install path | ~/.stryke/store/redis@<version>/ after make install; use Redis from any stryke script resolves it |
| Tests | zunit-style under t/ with live-service variants when applicable |
| CI | GitHub Actions .github/workflows/ci.yml — cargo fmt + clippy + test, plus stryke pkg install verification |
$WHY OPT-IN (NOT BUILTIN)
redis Rust crate (sync) with rustls TLS. Single highest-leverage daily-use connector after Postgres / MySQL.
The trade-off is intentional. The core stryke binary stays under ~40 MB precisely because each connector ships separately. Daily-driver work (one-liners, awk replacement, data scripting) doesn't need MongoDB drivers, AWS SDKs, or Spark Connect bindings linked in.
&FFI ENVELOPE
JSON in / JSON out across the FFI boundary. Each Redis::* wrapper serializes its args to a JSON dict and calls the matching redis__* symbol on the dlopen'd cdylib; the cdylib returns a JSON CString the wrapper parses. catch_unwind on every call converts panics to JSON errors. The returned CString is freed via the cdylib-exported stryke_free_cstring, wired automatically by rust_ffi::load_cdylib.
# request shape (built by the .stk wrapper)
{"verb": "<op>", "...": ...}
# response shape
{"value": ...} | {"values": [...]} | {"hash": {...}} | {"pairs": [[m, score], ...]} # success
{"error": "<msg>"} # failure — wrapper die()s with the message
%SURFACE CENSUS
The 166 connection-backed commands, broken down by Redis data type. Counts are computed from the fn Redis::* definitions in lib/Redis.stk.
| Family | Count | Representative ops |
|---|---|---|
| KV & strings | 24 | get set incr mset scan getex setex append |
| Bitmaps | 6 | setbit getbit bitcount bitop bitpos lcs |
| Lists | 15 | lpush rpop lrange lmove lpos lmpop |
| Sets | 16 | sadd sismember sinter spop sintercard smismember |
| Hashes | 15 | hset hgetall hmset hincrbyfloat hrandfield |
| Sorted sets | 24 | zadd zrange zrangebyscore zpopmin zunion zmpop |
| Key management | 13 | rename persist pexpire copy unlink object_encoding |
| HyperLogLog | 3 | pfadd pfcount pfmerge |
| Streams | 10 | xadd xrange xread xgroup_create xack xinfo_stream |
| Geospatial | 4 | geoadd geopos geodist geosearch |
| Scripting | 4 | eval evalsha script_load script_exists |
| Cursor scans | 3 | hscan sscan zscan |
| Pub/sub | 4 | publish pubsub_channels pubsub_numsub pubsub_numpat |
| Pipeline / transaction | 1 | pipeline |
| Server, admin & introspection | 24 | info config_get slowlog_get client_list acl_whoami object_freq |
Plus 18 pure helpers (no connection): INFO / CLIENT / CLUSTER reply parsers, URL parse/build/redact, Redis-glob match/escape/regex, cluster key-slot + co-location, and stream-id parse/build/compare/range/next/prev.
+DEPENDENCIES
The cdylib links a deliberately small set of foundational crates. None of these touch core stryke — they are linked only into libstryke_redis.
| Crate | Version | Role |
|---|---|---|
redis | 1.x | Sync Redis client; features acl, streams, geospatial, script, num-bigint, tls-rustls (default-features = false) |
serde / serde_json | 1.x | JSON-over-FFI encode/decode; preserve_order so hash field order survives |
anyhow | 1.x | Error propagation into the {"error": …} envelope |
once_cell | 1.x | OnceCell for the process-lifetime connection cache |
parking_lot | 0.12.x | Mutex guarding the connection map and each cached connection |
Release profile: opt-level = 3, lto = "thin", codegen-units = 1, strip = true, panic = "abort".
/SCOPE
See the README's "Why this is a package" + "API reference" sections for the authoritative scope. The package is intentionally narrower than its underlying SDK / driver — the goal is "useful from a shell pipeline", not "complete API coverage".
#PROJECT METADATA
| Item | Value |
|---|---|
| License | MIT |
| Author | MenkeTechnologies |
| Repository | github.com/MenkeTechnologies/stryke-redis |
| Parent language | strykelang |
| Meta umbrella | MenkeTechnologiesMeta |
| Issues | github.com/MenkeTechnologies/stryke-redis/issues |