Redis Commands Reference - Orbit-RS RESP Protocol

Overview

Orbit-RS provides full Redis compatibility through the RESP (Redis Serialization Protocol) adapter, supporting:

Connection Commands

PING [message]

Test server connection and optionally echo message.

PING

# "PONG"

PING "hello world" 

# "hello world"

ECHO message

Echo the given message back to client.

ECHO "Hello Redis!"

# "Hello Redis!"

SELECT db

Select database (logical separation, no-op for compatibility).

SELECT 0

# OK

AUTH [username] password

Authenticate with server (placeholder implementation).

AUTH mypassword

# OK

AUTH myuser mypassword

# OK

QUIT

Close connection gracefully.

QUIT

# OK

String/Key Commands

GET key

Retrieve value by key from KeyValueActor.

SET mykey "hello world"
GET mykey

# "hello world"

SET key value [EX seconds] [PX milliseconds]

Set key to value with optional expiration.

SET mykey "value"

# OK

SET mykey "value" EX 3600

# OK (expires in 1 hour)

SET mykey "value" PX 60000

# OK (expires in 60 seconds)

DEL key [key …]

Delete one or more keys.

DEL key1 key2 key3

# (integer) 2

EXISTS key [key …]

Check if keys exist.

EXISTS key1 key2

# (integer) 1

TTL key

Get time-to-live in seconds (-1 = no expiration, -2 = key doesn’t exist).

TTL mykey

# (integer) 299

EXPIRE key seconds

Set expiration time in seconds.

EXPIRE mykey 300

# (integer) 1

Extended String Commands

APPEND key value

Append value to existing string.

SET mykey "Hello"
APPEND mykey " World"

# (integer) 11
GET mykey

# "Hello World"

GETRANGE key start end

Get substring by byte range.

SET mykey "Hello World"
GETRANGE mykey 0 4

# "Hello"

GETSET key value

Set new value and return old value atomically.

SET mykey "old"
GETSET mykey "new"

# "old"

MGET key [key …]

Get multiple keys at once.

MSET key1 "value1" key2 "value2" key3 "value3"
MGET key1 key2 key3

# 1) "value1"
# 2) "value2"
# 3) "value3"

MSET key value [key value …]

Set multiple key-value pairs.

MSET key1 "value1" key2 "value2" key3 "value3"

# OK

SETEX key seconds value

Set key with expiration time.

SETEX mykey 60 "temporary value"

# OK

SETRANGE key offset value

Overwrite string at specific offset.

SET mykey "Hello World"
SETRANGE mykey 6 "Redis"

# (integer) 11
GET mykey

# "Hello Redis"

STRLEN key

Get string length.

SET mykey "Hello World"
STRLEN mykey

# (integer) 11

Hash Commands

HGET key field

Get field value from hash.

HSET user:1 name "Alice" age "30"
HGET user:1 name

# "Alice"

HSET key field value [field value …]

Set field values in hash.

HSET user:1 name "Alice" age "30" city "NYC"

# (integer) 3

HGETALL key

Get all field-value pairs from hash.

HGETALL user:1

# 1) "name"
# 2) "Alice"
# 3) "age"
# 4) "30"
# 5) "city"
# 6) "NYC"

HDEL key field [field …]

Delete fields from hash.

HDEL user:1 age city

# (integer) 2

HEXISTS key field

Check if field exists in hash.

HEXISTS user:1 name

# (integer) 1

HKEYS key

Get all field names from hash.

HKEYS user:1

# 1) "name"
# 2) "age"
# 3) "city"

HVALS key

Get all values from hash.

HVALS user:1

# 1) "Alice"
# 2) "30"
# 3) "NYC"

HLEN key

Get number of fields in hash.

HLEN user:1

# (integer) 3

Extended Hash Commands

HMGET key field [field …]

Get multiple field values.

HMGET user:1 name age city

# 1) "Alice"
# 2) "30"
# 3) "NYC"

HMSET key field value [field value …]

Set multiple field values (legacy, use HSET).

HMSET user:1 name "Alice" age "30"

# OK

HINCRBY key field increment

Increment field by integer value.

HSET user:1 score 100
HINCRBY user:1 score 50

# (integer) 150

List Commands

LPUSH key element [element …]

Push elements to left (head) of list.

LPUSH mylist "world" "hello"

# (integer) 2

RPUSH key element [element …]

Push elements to right (tail) of list.

RPUSH mylist "foo" "bar"

# (integer) 4

LPOP key [count]

Pop element(s) from left (head) of list.

LPOP mylist

# "hello"

LPOP mylist 2

# 1) "world"
# 2) "foo"

RPOP key [count]

Pop element(s) from right (tail) of list.

RPOP mylist

# "bar"

RPOP mylist 2

# 1) "foo"
# 2) "world"

LRANGE key start stop

Get range of elements from list.

LRANGE mylist 0 -1

# 1) "hello"
# 2) "world"
# 3) "foo"
# 4) "bar"

LRANGE mylist 1 2

# 1) "world"
# 2) "foo"

LLEN key

Get length of list.

LLEN mylist

# (integer) 4

Extended List Commands

LINDEX key index

Get element at index.

LINDEX mylist 0

# "hello"

LINDEX mylist -1

# "bar"

LSET key index element

Set element at index.

LSET mylist 0 "hi"

# OK

LREM key count element

Remove elements equal to element.

LREM mylist 2 "foo"

# (integer) 1

LTRIM key start stop

Trim list to specified range.

LTRIM mylist 1 -1

# OK

LINSERT key BEFORE|AFTER pivot element

Insert element before or after pivot.

LINSERT mylist BEFORE "world" "beautiful"

# (integer) 5

BLPOP key [key …] timeout

Blocking left pop (non-blocking in current implementation).

BLPOP mylist 10

# 1) "mylist"
# 2) "element"

BRPOP key [key …] timeout

Blocking right pop (non-blocking in current implementation).

BRPOP mylist 10

# 1) "mylist"
# 2) "element"

Set Commands

SADD key member [member …]

Add members to set.

SADD myset "apple" "banana" "cherry"

# (integer) 3

SREM key member [member …]

Remove members from set.

SREM myset "banana"

# (integer) 1

SMEMBERS key

Get all members of set.

SMEMBERS myset

# 1) "apple"
# 2) "cherry"

SCARD key

Get cardinality (size) of set.

SCARD myset

# (integer) 2

SISMEMBER key member

Check if member exists in set.

SISMEMBER myset "apple"

# (integer) 1

SUNION key [key …]

Return union of sets.

SADD set1 "a" "b" "c"
SADD set2 "c" "d" "e"
SUNION set1 set2

# 1) "a"
# 2) "b"
# 3) "c"
# 4) "d"
# 5) "e"

SINTER key [key …]

Return intersection of sets.

SINTER set1 set2

# 1) "c"

SDIFF key [key …]

Return difference of sets.

SDIFF set1 set2

# 1) "a"
# 2) "b"

Sorted Set Commands

ZADD key score member [score member …]

Add members with scores to sorted set.

ZADD leaderboard 100 "alice" 85 "bob" 92 "charlie"

# (integer) 3

ZREM key member [member …]

Remove members from sorted set.

ZREM leaderboard "bob"

# (integer) 1

ZCARD key

Get cardinality of sorted set.

ZCARD leaderboard

# (integer) 2

ZSCORE key member

Get score of member.

ZSCORE leaderboard "alice"

# "100"

ZINCRBY key increment member

Increment score of member.

ZINCRBY leaderboard 10 "charlie"

# "102"

ZRANGE key start stop [WITHSCORES]

Get members by rank range.

ZRANGE leaderboard 0 -1 WITHSCORES

# 1) "alice"
# 2) "100"
# 3) "charlie"
# 4) "102"

ZRANGEBYSCORE key min max [WITHSCORES]

Get members by score range.

ZRANGEBYSCORE leaderboard 90 110 WITHSCORES

# 1) "alice"
# 2) "100"
# 3) "charlie"
# 4) "102"

ZCOUNT key min max

Count members in score range.

ZCOUNT leaderboard 90 110

# (integer) 2

ZRANK key member

Get rank of member (0-based).

ZRANK leaderboard "alice"

# (integer) 0

Pub/Sub Commands

PUBLISH channel message

Publish message to channel.

PUBLISH news "Breaking news!"

# (integer) 3

SUBSCRIBE channel [channel …]

Subscribe to channels.

SUBSCRIBE news weather sports

# 1) "subscribe"
# 2) "news"
# 3) (integer) 1

UNSUBSCRIBE [channel [channel …]]

Unsubscribe from channels.

UNSUBSCRIBE news

# 1) "unsubscribe"
# 2) "news"
# 3) (integer) 0

PSUBSCRIBE pattern [pattern …]

Subscribe to channel patterns.

PSUBSCRIBE news.*

# 1) "psubscribe"
# 2) "news.*"
# 3) (integer) 1

PUNSUBSCRIBE [pattern [pattern …]]

Unsubscribe from channel patterns.

PUNSUBSCRIBE news.*

# 1) "punsubscribe"
# 2) "news.*"
# 3) (integer) 0

PUBSUB subcommand [argument [argument …]]

Introspect pub/sub system.

PUBSUB CHANNELS

# 1) "news"
# 2) "weather"

PUBSUB NUMSUB news weather

# 1) "news"
# 2) (integer) 3
# 3) "weather"
# 4) (integer) 1

Vector Operations (VECTOR.* namespace)

VECTOR.ADD index id vector [key value …]

Add vector with optional metadata to index.

VECTOR.ADD doc_embeddings doc1 "0.1,0.2,0.3,0.4" title "First Document" category "tech"

# OK

VECTOR.GET index id

Get vector and metadata by ID.

VECTOR.GET doc_embeddings doc1

# 1) "doc1"
# 2) "0.100000,0.200000,0.300000,0.400000"
# 3) "title"
# 4) "First Document"
# 5) "category"
# 6) "tech"

VECTOR.DEL index id

Delete vector from index.

VECTOR.DEL doc_embeddings doc1

# (integer) 1

VECTOR.STATS index

Get statistics for vector index.

VECTOR.STATS doc_embeddings

# 1) "vector_count"
# 2) (integer) 1000
# 3) "index_count"
# 4) (integer) 1
# 5) "avg_dimension"
# 6) "768.00"

VECTOR.LIST index

List all vector IDs in index.

VECTOR.LIST doc_embeddings

# 1) "doc1"
# 2) "doc2"
# 3) "doc3"

VECTOR.COUNT index

Get count of vectors in index.

VECTOR.COUNT doc_embeddings

# (integer) 1000

VECTOR.SEARCH index vector limit [METRIC metric] [THRESHOLD threshold] [key value …]

Perform vector similarity search.

VECTOR.SEARCH doc_embeddings "0.1,0.2,0.3,0.4" 5 METRIC COSINE THRESHOLD 0.8 category "tech"

# 1) 1) "doc1"
#    2) "0.950000"
#    3) "0.100000,0.200000,0.300000,0.400000"
#    4) "title"
#    5) "First Document"
# 2) 1) "doc2"
#    2) "0.920000"
#    3) "0.150000,0.180000,0.320000,0.380000"

VECTOR.KNN index vector k [METRIC metric]

K-nearest neighbors search.

VECTOR.KNN doc_embeddings "0.1,0.2,0.3,0.4" 3 METRIC EUCLIDEAN

# 1) 1) "doc1"
#    2) "0.050000"
# 2) 1) "doc2"
#    2) "0.082000"

RedisSearch Compatible Commands (FT.* namespace)

FT.CREATE index DIM dimension [DISTANCE_METRIC metric]

Create vector index.

FT.CREATE doc_index DIM 768 DISTANCE_METRIC COSINE

# OK

FT.ADD index id vector [key value …]

Add document to index (alias for VECTOR.ADD).

FT.ADD doc_index doc1 "0.1,0.2,0.3,..." title "Document"

# OK

FT.DEL index id

Delete document from index.

FT.DEL doc_index doc1

# (integer) 1

FT.SEARCH index vector limit [DISTANCE_METRIC metric] [key value …]

Search index (converted to VECTOR.SEARCH format).

FT.SEARCH doc_index "0.1,0.2,0.3,..." 10 DISTANCE_METRIC COSINE

# (search results)

FT.INFO index

Get index information.

FT.INFO doc_index

# 1) "index_name"
# 2) "doc_index"
# 3) "num_docs"
# 4) (integer) 1000

Time Series Commands (TS.* namespace)

TS.CREATE key [RETENTION retentionTime] [CHUNK_SIZE size] [DUPLICATE_POLICY policy] [LABELS label value …]

Create time series.

TS.CREATE temperature:sensor1 RETENTION 3600000 CHUNK_SIZE 4096 LABELS sensor_id "001" location "office"

# OK

TS.ALTER key [RETENTION retentionTime] [CHUNK_SIZE size] [DUPLICATE_POLICY policy] [LABELS label value …]

Alter time series configuration.

TS.ALTER temperature:sensor1 RETENTION 7200000

# OK

TS.ADD key timestamp value [RETENTION retentionTime] [CHUNK_SIZE size] [DUPLICATE_POLICY policy] [LABELS label value …]

Add sample to time series.

TS.ADD temperature:sensor1 1609459200000 23.5

# (integer) 1609459200000

TS.ADD temperature:sensor1 * 24.1

# (integer) 1609459260000

TS.MADD key1 timestamp1 value1 [key2 timestamp2 value2 …]

Add multiple samples.

TS.MADD temperature:sensor1 1609459200000 23.5 temperature:sensor2 1609459200000 22.8

# 1) (integer) 1609459200000
# 2) (integer) 1609459200000

TS.INCRBY key value [TIMESTAMP timestamp] [RETENTION retentionTime] [CHUNK_SIZE size] [DUPLICATE_POLICY policy] [LABELS label value …]

Increment time series by value.

TS.INCRBY counter:requests 1 TIMESTAMP 1609459200000

# (integer) 1609459200000

TS.DECRBY key value [TIMESTAMP timestamp] [RETENTION retentionTime] [CHUNK_SIZE size] [DUPLICATE_POLICY policy] [LABELS label value …]

Decrement time series by value.

TS.DECRBY counter:requests 1 TIMESTAMP 1609459200000

# (integer) 1609459200000

TS.DEL key fromTimestamp toTimestamp

Delete samples in time range.

TS.DEL temperature:sensor1 1609459200000 1609459260000

# (integer) 2

TS.GET key

Get latest sample.

TS.GET temperature:sensor1

# 1) (integer) 1609459260000
# 2) "24.1"

TS.MGET [FILTER label=value …] key1 [key2 …]

Get latest samples from multiple time series.

TS.MGET temperature:sensor1 temperature:sensor2

# 1) 1) "temperature:sensor1"
#    2) (integer) 1609459260000
#    3) "24.1"
# 2) 1) "temperature:sensor2"
#    2) (integer) 1609459260000
#    3) "22.8"

TS.INFO key

Get time series information.

TS.INFO temperature:sensor1

# 1) "totalSamples"
# 2) (integer) 100
# 3) "memoryUsage"
# 4) (integer) 4096
# 5) "firstTimestamp"
# 6) (integer) 1609459200000
# 7) "lastTimestamp"
# 8) (integer) 1609459260000

TS.RANGE key fromTimestamp toTimestamp [AGGREGATION aggregation bucketDuration]

Get samples in time range.

TS.RANGE temperature:sensor1 1609459200000 1609459260000

# 1) 1) (integer) 1609459200000
#    2) "23.5"
# 2) 1) (integer) 1609459260000
#    2) "24.1"

TS.RANGE temperature:sensor1 1609459200000 1609459260000 AGGREGATION AVG 60000

# 1) 1) (integer) 1609459200000
#    2) "23.8"

TS.REVRANGE key fromTimestamp toTimestamp [AGGREGATION aggregation bucketDuration]

Get samples in reverse time order.

TS.REVRANGE temperature:sensor1 1609459200000 1609459260000

# 2) 1) (integer) 1609459260000
#    2) "24.1"
# 1) 1) (integer) 1609459200000
#    2) "23.5"

TS.MRANGE fromTimestamp toTimestamp [AGGREGATION aggregation bucketDuration] [FILTER label=value …] key1 [key2 …]

Get range from multiple time series.

TS.MRANGE 1609459200000 1609459260000 temperature:sensor1 temperature:sensor2

# 1) 1) "temperature:sensor1"
#    2) (empty array)
#    3) 1) 1) (integer) 1609459200000
#          2) "23.5"
#       2) 1) (integer) 1609459260000
#          2) "24.1"

TS.MREVRANGE fromTimestamp toTimestamp [AGGREGATION aggregation bucketDuration] [FILTER label=value …] key1 [key2 …]

Get reverse range from multiple time series.

TS.MREVRANGE 1609459200000 1609459260000 temperature:sensor1 temperature:sensor2

# (reverse time order results)

TS.QUERYINDEX [FILTER label=value …]

Query time series index (placeholder).

TS.QUERYINDEX

# (empty array)

TS.CREATERULE sourceKey destKey AGGREGATION aggregation bucketDuration [retention]

Create compaction rule.

TS.CREATERULE temperature:sensor1 temperature:sensor1:hourly AGGREGATION AVG 3600000

# OK

TS.DELETERULE sourceKey destKey

Delete compaction rule.

TS.DELETERULE temperature:sensor1 temperature:sensor1:hourly

# OK

Graph Database Commands (GRAPH.* namespace)

GRAPH.QUERY graph_name query

Execute graph query.

GRAPH.QUERY social "MATCH (p:Person) RETURN p.name"

# 1) 1) "p.name"
# 2) 1) 1) "Alice"
#    2) 1) "Bob"
#    3) 1) "Charlie"
# 3) 1) "Cached execution"
#    2) "Query internal execution time: 0.000000 milliseconds"

GRAPH.RO_QUERY graph_name query

Execute read-only graph query.

GRAPH.RO_QUERY social "MATCH (p:Person) WHERE p.age > 25 RETURN p"

# (query results similar to GRAPH.QUERY)

GRAPH.DELETE graph_name

Delete entire graph.

GRAPH.DELETE social

# OK

GRAPH.LIST

List all graphs.

GRAPH.LIST

# 1) "demo_graph"
# 2) "social_network"

GRAPH.EXPLAIN graph_name query

Get execution plan for query.

GRAPH.EXPLAIN social "MATCH (p:Person) RETURN p"

# 1) 1) "1: Scan"
#    2) "Node Scan | (p:Person)"
#    3) "Estimated rows: 1000"
#    4) "Cost: 1000.00"
# 2) 1) "Total estimated cost: 1000.00"

GRAPH.PROFILE graph_name query

Profile query execution.

GRAPH.PROFILE social "MATCH (p:Person) RETURN p"

# 1) (empty array)
# 2) (empty array)
# 3) 1) "1: Scan"
#    2) "Node Scan | (p:Person)"
#    3) "Records produced: 1000"
#    4) "Execution time: 5 ms"
#    5) "Memory used: 8192 bytes"

GRAPH.SLOWLOG graph_name

Get slow query log.

GRAPH.SLOWLOG social

# 1) 1) (integer) 1
#    2) (integer) 1609459200
#    3) (integer) 1500
#    4) "MATCH (p:Person) RETURN p"
#    5) 1) "index_scan"
#       2) "node_scan"

GRAPH.CONFIG GET|SET parameter [value]

Configure graph settings.

GRAPH.CONFIG GET timeout

# 1) "timeout"
# 2) "1000"

GRAPH.CONFIG SET timeout 2000

# OK

Server Commands

INFO [section]

Get server information with Orbit-specific details.

INFO

# # Server
# redis_version:7.0.0-orbit
# redis_git_sha1:00000000
# redis_git_dirty:0
# redis_mode:standalone
# os:Darwin 23.6.0 x86_64
# arch_bits:64
# process_id:12345
# uptime_in_seconds:3600
# 
# # Orbit
# orbit_mode:protocol_adapter
# orbit_actor_count:0
# orbit_cluster_nodes:1

DBSIZE

Get number of keys (placeholder implementation).

DBSIZE

# (integer) 0

FLUSHDB

Clear current database (placeholder implementation).

FLUSHDB

# OK

FLUSHALL

Clear all databases (placeholder implementation).

FLUSHALL

# OK

COMMAND

Get list of available commands.

COMMAND

# 1) 1) "ping"
#    2) (integer) -1
#    3) (integer) 1
#    4) (integer) 0
#    5) (integer) 0
# 2) 1) "get"
#    2) (integer) 2
#    3) (integer) 1
#    4) (integer) 1
#    5) (integer) 1
# ... (all supported commands)

Additional String Commands

PERSIST key

Remove expiration from key.

EXPIRE mykey 60
PERSIST mykey

# (integer) 1
TTL mykey

# (integer) -1

PEXPIRE key milliseconds

Set expiration in milliseconds.

PEXPIRE mykey 60000

# (integer) 1

PTTL key

Get TTL in milliseconds.

PTTL mykey

# (integer) 59850

RANDOMKEY

Get random key (placeholder implementation).

RANDOMKEY

# (nil)

RENAME oldkey newkey

Rename key.

SET oldkey "value"
RENAME oldkey newkey

# OK
GET newkey

# "value"

TYPE key

Get type of key.

SET mystring "value"
HSET myhash field value
LPUSH mylist item
TYPE mystring

# string
TYPE myhash

# hash
TYPE mylist

# list

Asynchronous delete (same as DEL in current implementation).

UNLINK key1 key2 key3

# (integer) 2

Actor Integration

Each command family maps to specific Orbit actors:

Configuration

[protocols.redis]
enabled = true
host = "0.0.0.0"
port = 6380
max_connections = 1000
default_ttl = 3600

[protocols.redis.vector]
default_similarity_metric = "cosine"
index_type = "hnsw"
ef_construction = 200
m = 16

[protocols.redis.timeseries]
default_retention = 86400000  # 24 hours in milliseconds
default_chunk_size = 4096
default_duplicate_policy = "block"

[protocols.redis.graph]
query_timeout = 30000  # 30 seconds
max_query_result_set = 10000
enable_query_cache = true

Performance Notes

Compatibility

This comprehensive command set makes Orbit-RS a drop-in replacement for Redis with enterprise-grade distributed computing capabilities and advanced AI/ML features.