A Redis-compatible in-memory store built into the same server. It speaks the RESP wire protocol, so redis-cli and existing Redis client libraries work unmodified. On the single-command benchmark it runs at 93–101% of Redis, and beats Redis on pipelined writes. Off by default.
# start the RESP listener on a port (Redis' default is 6379)
OXIDB_OXIMEM_PORT=6379 ./oxidb-server
# talk to it with the ordinary redis-cli
redis-cli -p 6379 PING # PONG
| Type | Commands |
|---|---|
| Strings | GET SET SETNX SETEX GETSET APPEND INCR DECR INCRBY MGET MSET |
| Keys | DEL EXISTS TYPE KEYS SCAN EXPIRE TTL |
| Hashes | HSET HGET HGETALL HDEL |
| Lists | LPUSH RPUSH LPOP RPOP LRANGE |
| Sets | SADD SMEMBERS SCARD |
| Sorted sets | ZADD ZRANGE ZSCORE |
redis-cli -p 6379 SET user:1 Alice
redis-cli -p 6379 INCR visits
redis-cli -p 6379 HSET user:1 age 30 country TR
redis-cli -p 6379 RPUSH queue job1 job2 job3
redis-cli -p 6379 ZADD leaderboard 100 alice 90 bob
redis-cli -p 6379 EXPIRE user:1 3600
Optimistic transactions with WATCH (check-and-set): queue commands with MULTI, run them atomically with EXEC; if a WATCHed key changed, EXEC aborts.
WATCH balance
MULTI
DECRBY balance 100
INCRBY spent 100
EXEC # nil if 'balance' was modified by another client
# DISCARD / UNWATCH also supported
Run atomic server-side Lua (mlua). Scripts hold striped key locks so independent scripts run concurrently.
redis-cli -p 6379 EVAL "redis.call('SET', KEYS[1], ARGV[1]); return redis.call('GET', KEYS[1])" 1 mykey hello
Channel and pattern subscriptions, cross-protocol: a message PUBLISHed here can also reach MQTT subscribers.
# terminal 1
redis-cli -p 6379 SUBSCRIBE news # or PSUBSCRIBE news.*
# terminal 2
redis-cli -p 6379 PUBLISH news "hello"
OxiMem is in-memory by default. Two independent durability options:
| Env var | Effect |
|---|---|
OXIDB_OXIMEM_SNAPSHOT_SECS | Periodic snapshot of the keyspace to disk (RDB-style), reloaded on restart. |
OXIDB_OXIMEM_SQL | Mirror writes into a SQL table, so the keyspace survives restarts and is queryable from the SQL engine. |
import redis
r = redis.Redis(host="127.0.0.1", port=6379)
r.set("user:1", "Alice")
r.incr("visits")
with r.pipeline() as p: # pipelined writes beat Redis
for i in range(1000): p.set(f"k{i}", i)
p.execute()
The keyspace is global (shared across databases). Pub/sub is cross-protocol: a message published here can reach subscribers on the built-in MQTT broker.