Commands
DbSync implements the Redis Serialization Protocol (RESP2/RESP3). All commands listed here are wire-compatible with Redis clients.
Overview
DbSync supports a focused subset of the Redis command set, optimized for high-throughput key-value workloads. Commands are parsed using a zero-copy RESP parser for minimal overhead.
Implemented Commands currently available in the codebase.
Coming Soon Commands planned for future releases.
Implemented Commands
The following commands are currently implemented in DbSync's engine.
SETcommandrequiredSet a key to a string value with optional TTL.
SET key value [EX seconds] [PX milliseconds]
| Option | Description |
|---|---|
EX seconds | Set expiry in seconds |
PX milliseconds | Set expiry in milliseconds |
Supports cross-core request hopping via the SPSC ITC bus when the key is owned by a different reactor.
Time complexity: O(1)
GETcommandrequiredGet the value of a key. Returns nil if the key does not exist.
GET key
If the key belongs to a remote shard, the request is transparently forwarded via the inter-thread communication bus.
Time complexity: O(1)
PINGcommandrequiredTest connectivity. Returns PONG.
PING
EXPIREcommandrequiredSet a timeout on a key (in seconds).
EXPIRE key seconds
Time complexity: O(1)
DELcommandrequiredDelete a key. Returns 1 if the key was deleted, 0 otherwise.
DEL key
Time complexity: O(1)
EXISTScommandrequiredCheck if a key exists. Returns 1 if the key exists, 0 otherwise.
EXISTS key
Time complexity: O(1)
TTLcommandrequiredGet the time to live of a key in seconds. Returns -1 if no timeout is set, -2 if the key does not exist.
TTL key
Time complexity: O(1)
PTTLcommandrequiredGet the time to live of a key in milliseconds. Returns -1 if no timeout is set, -2 if the key does not exist.
PTTL key
Time complexity: O(1)
CONFIGcommandServer configuration command. Used for client compatibility (e.g., CONFIG GET save).
CONFIG GET parameter
CONFIG SET parameter value
Pipelining
DbSync fully supports command pipelining. Clients can send multiple commands without waiting for individual responses, dramatically improving throughput.
# Example: pipeline 3 commands
(printf "SET key1 val1\r\nSET key2 val2\r\nGET key1\r\n"; sleep 1) | redis-cli --pipe
| Mode | Throughput | Latency |
|---|---|---|
| No pipelining | ~120K ops/sec | 0.4ms |
| Pipeline depth 10 | ~500K ops/sec | 0.8ms |
| Pipeline depth 100 | ~900K ops/sec | 2.1ms |
For maximum throughput, use a pipeline depth of 10–50. Beyond that, gains diminish while memory usage increases.
Coming Soon
The following commands are planned for upcoming releases:
| Command | Category | Status |
|---|---|---|
INCR / DECR | String Commands | Planned |
INCRBY / DECRBY | String Commands | Planned |
MGET / MSET | Multi-key Operations | Planned |
PEXPIRE | Key Management | Planned |
INFO | Server Commands | Planned |
FLUSHDB | Server Commands | Planned |
SHUTDOWN | Server Commands | Planned |
Hash commands (HSET, HGET, HDEL) | Data Structures | Planned |
List commands (LPUSH, RPUSH, LRANGE) | Data Structures | Planned |
Set commands (SADD, SMEMBERS) | Data Structures | Planned |
Sorted Sets (ZADD, ZRANGE) | Data Structures | Planned |
Pub/Sub (SUBSCRIBE, PUBLISH) | Messaging | Planned |
Transactions (MULTI, EXEC) | Transactions | Planned |
Want to contribute? Check out the repository on GitHub and help implement new commands.