// STRYKE-REDIS — ENGINEERING REPORT

Opt-in stryke connector package · cdylib libstryke_redis.{dylib,so} (crate-type = cdylib) · dlopen'd in-process on use Redis · JSON-over-FFI envelope

>_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.

184
Public Redis:: fns
166
Connection ops
18
Pure helpers
184
FFI exports (redis__*)
0.19.0
Version
cdylib
Crate type
opt-in
Tier
dlopen
Load model
JSON-over-FFI
Envelope

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.

LayerImplementation
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 modelLibrary 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
BuildCargo 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
Testszunit-style under t/ with live-service variants when applicable
CIGitHub 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.

FamilyCountRepresentative ops
KV & strings24get set incr mset scan getex setex append
Bitmaps6setbit getbit bitcount bitop bitpos lcs
Lists15lpush rpop lrange lmove lpos lmpop
Sets16sadd sismember sinter spop sintercard smismember
Hashes15hset hgetall hmset hincrbyfloat hrandfield
Sorted sets24zadd zrange zrangebyscore zpopmin zunion zmpop
Key management13rename persist pexpire copy unlink object_encoding
HyperLogLog3pfadd pfcount pfmerge
Streams10xadd xrange xread xgroup_create xack xinfo_stream
Geospatial4geoadd geopos geodist geosearch
Scripting4eval evalsha script_load script_exists
Cursor scans3hscan sscan zscan
Pub/sub4publish pubsub_channels pubsub_numsub pubsub_numpat
Pipeline / transaction1pipeline
Server, admin & introspection24info 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.

CrateVersionRole
redis1.xSync Redis client; features acl, streams, geospatial, script, num-bigint, tls-rustls (default-features = false)
serde / serde_json1.xJSON-over-FFI encode/decode; preserve_order so hash field order survives
anyhow1.xError propagation into the {"error": …} envelope
once_cell1.xOnceCell for the process-lifetime connection cache
parking_lot0.12.xMutex 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

ItemValue
LicenseMIT
AuthorMenkeTechnologies
Repositorygithub.com/MenkeTechnologies/stryke-redis
Parent languagestrykelang
Meta umbrellaMenkeTechnologiesMeta
Issuesgithub.com/MenkeTechnologies/stryke-redis/issues