OxiMem — in-memory store

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.

Enable it

# 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

Data types & commands

TypeCommands
StringsGET SET SETNX SETEX GETSET APPEND INCR DECR INCRBY MGET MSET
KeysDEL EXISTS TYPE KEYS SCAN EXPIRE TTL
HashesHSET HGET HGETALL HDEL
ListsLPUSH RPUSH LPOP RPOP LRANGE
SetsSADD SMEMBERS SCARD
Sorted setsZADD 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

Transactions — MULTI / EXEC / WATCH

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

Lua scripting — EVAL

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

Pub / Sub

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"

Persistence (optional)

OxiMem is in-memory by default. Two independent durability options:

Env varEffect
OXIDB_OXIMEM_SNAPSHOT_SECSPeriodic snapshot of the keyspace to disk (RDB-style), reloaded on restart.
OXIDB_OXIMEM_SQLMirror writes into a SQL table, so the keyspace survives restarts and is queryable from the SQL engine.

Use it from any Redis client

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.

Report Issue