Skip to content

Commands Overview

Redlite implements the Redis protocol and supports most Redis commands. For detailed command documentation, refer to the official Redis documentation.

See COMMANDS.md for the complete list of supported commands.

  • ✅ Strings - GET, SET, MGET, MSET, INCR, APPEND, etc.
  • ✅ Hashes - HGET, HSET, HGETALL, HDEL, HINCRBY, etc.
  • ✅ Lists - LPUSH, RPUSH, LPOP, RPOP, LRANGE, etc.
  • ✅ Sets - SADD, SREM, SMEMBERS, SDIFF, SINTER, SUNION, etc.
  • ✅ Sorted Sets - ZADD, ZREM, ZRANGE, ZRANGEBYSCORE, etc.
  • ✅ Streams - XADD, XREAD, XRANGE, XGROUP, XREADGROUP, etc.
  • ✅ RediSearch - FT.CREATE, FT.SEARCH, FT.INFO, FT.AGGREGATE, FT.ALTER, FT.DROPINDEX, aliases, synonyms, suggestions
  • ✅ Vector Search - VADD, VSIM, VREM, VCARD, VDIM, VGET, VGETALL, VGETATTRIBUTES, VSETATTRIBUTES (requires --features vectors)
  • ✅ Transactions - MULTI, EXEC, DISCARD, WATCH, UNWATCH
  • ❌ Lua Scripting - EVAL, EVALSHA (not supported)
  • ✅ Authentication - AUTH, password support via --password flag
  • ✅ Client Commands - CLIENT SETNAME, GETNAME, LIST, ID, INFO, KILL, PAUSE, UNPAUSE

These features require server mode and are not available in embedded library mode:

Commands that wait for data with timeouts:

  • BLPOP, BRPOP - Blocking list operations
  • XREAD BLOCK - Blocking stream reads
  • BRPOPLPUSH, BLMOVE - Blocking list moves

Server-only limitation: Cross-client coordination requires a central server process to manage waiters.

Messaging via publish/subscribe channels:

  • SUBSCRIBE, UNSUBSCRIBE - Channel subscriptions
  • PSUBSCRIBE, PUNSUBSCRIBE - Pattern subscriptions
  • PUBLISH - Publish messages

Server-only limitation: Message routing requires a central broker to maintain subscriber lists.

Redlite adds commands that Redis doesn’t have:

Delete expired keys and run SQLite VACUUM:

Terminal window
127.0.0.1:6379> VACUUM
OK

Library mode:

db.vacuum()?;

Use cases:

  • Remove expired keys (lazy expiration only deletes on read)
  • Reclaim disk space (SQLite VACUUM compacts database file)
  • Maintenance operations

Get detailed metadata about a key:

Terminal window
127.0.0.1:6379> KEYINFO mykey
1) "type"
2) "string"
3) "ttl"
4) (integer) 3600000
5) "created_at"
6) (integer) 1704067200000
7) "updated_at"
8) (integer) 1704067200000

Library mode:

let info = db.keyinfo("mykey")?;
println!("Type: {:?}, TTL: {:?}", info.key_type, info.ttl);

Fields:

  • type - Key type (string, hash, list, set, zset, stream)
  • ttl - Time-to-live in milliseconds (nil if no expiration)
  • created_at - Creation timestamp (milliseconds)
  • updated_at - Last update timestamp (milliseconds)

Track and query historical data with time-travel queries:

Terminal window
# Enable history tracking
127.0.0.1:6379> HISTORY ENABLE KEY mykey RETENTION COUNT 100
OK
# Query history
127.0.0.1:6379> HISTORY GET mykey LIMIT 10
[... history entries ...]
# Time-travel query
127.0.0.1:6379> HISTORY GETAT mykey 1704067200000
"historical_value"

See History Tracking for full documentation.

Redlite uses lazy expiration:

  • Expired keys checked on read access
  • Manual cleanup via VACUUM command
  • No background expiration daemon

Implementation rationale: Expired keys remain on disk until accessed or explicitly removed via VACUUM.

Redlite persists data by default:

  • All writes committed to SQLite database file
  • ACID guarantees via SQLite’s transaction system
  • No separate SAVE or BGSAVE commands

Implementation: SQLite WAL mode provides durability without requiring manual persistence configuration.

Server mode provides MULTI/EXEC for command batching:

Terminal window
127.0.0.1:6379> MULTI
OK
127.0.0.1:6379> SET key1 value1
QUEUED
127.0.0.1:6379> SET key2 value2
QUEUED
127.0.0.1:6379> EXEC
1) OK
2) OK

Use WATCH for optimistic locking (check-and-set):

Terminal window
127.0.0.1:6379> WATCH mykey
OK
127.0.0.1:6379> GET mykey
"100"
127.0.0.1:6379> MULTI
OK
127.0.0.1:6379> SET mykey 101
QUEUED
127.0.0.1:6379> EXEC
1) OK
# Returns nil if mykey was modified by another client

For detailed command syntax and behavior, see:

Redlite implements the RESP protocol and aims for command-level compatibility with Redis.