Server commands provide health checks, introspection, and administrative operations for the Kora server.
PING
Ping the server to test connectivity.
Syntax
Optional message to echo back
Return value
“PONG” if no message provided, otherwise the message itself
Examples
redis-cli> PING
PONG
redis-cli> PING "hello world"
"hello world"
Time complexity: O(1)
Notes:
- Used for health checks and connection validation
- Works in pub/sub mode
- Measures round-trip latency
ECHO
Echo the given string.
Syntax
Return value
Examples
redis-cli> ECHO "Hello Kora!"
"Hello Kora!"
Time complexity: O(1)
INFO
Get server information and statistics.
Syntax
Optional section filter: server, memory, stats, replication, cpu, commandstats, cluster, keyspace
Return value
Server information as key-value pairs
Examples
redis-cli> INFO
# Server
kora_version:0.1.0
os:Linux 5.15.0 x86_64
arch_bits:64
process_id:12345
tcp_port:6379
uptime_in_seconds:3600
# Memory
used_memory:104857600
used_memory_human:100M
mem_fragmentation_ratio:1.05
# Stats
total_commands_processed:1000000
instantaneous_ops_per_sec:50000
total_net_input_bytes:524288000
total_net_output_bytes:1048576000
redis-cli> INFO memory
# Memory
used_memory:104857600
used_memory_human:100M
mem_fragmentation_ratio:1.05
Time complexity: O(1)
Sections:
- server - General server information
- memory - Memory usage statistics
- stats - Command statistics
- replication - Replication status (if enabled)
- cpu - CPU usage
- commandstats - Per-command statistics
- keyspace - Database key counts and expiration stats
DBSIZE
Return the number of keys in the current database.
Syntax
Return value
The total number of keys across all shards
Examples
redis-cli> DBSIZE
(integer) 1234567
Time complexity: O(1)
FLUSHDB
Delete all keys in the current database.
Syntax
Return value
Examples
redis-cli> FLUSHDB
OK
redis-cli> DBSIZE
(integer) 0
Time complexity: O(N) where N is the total number of keys
Warning: This operation is destructive and cannot be undone.
FLUSHALL
Delete all keys in all databases.
Syntax
Return value
Examples
Time complexity: O(N) where N is the total number of keys across all databases
Warning: This operation is destructive and cannot be undone.
BGSAVE
Trigger a background RDB snapshot.
Syntax
Return value
“Background saving started” if successful
Examples
redis-cli> BGSAVE
Background saving started
Time complexity: O(1) to trigger, O(N) background operation where N is dataset size
Notes:
- Creates a point-in-time snapshot of the database
- Writes to a temporary file, then atomically renames it
- Non-blocking (server continues serving requests)
- Snapshot file location configured in
data_dir
BGREWRITEAOF
Trigger a background WAL rewrite.
Syntax
Return value
“Background append only file rewriting started” if successful
Examples
redis-cli> BGREWRITEAOF
Background append only file rewriting started
Time complexity: O(1) to trigger, O(N) background operation where N is dataset size
Notes:
- Compacts the write-ahead log (WAL)
- Removes redundant operations
- Reduces WAL size and recovery time
- Non-blocking operation
COMMAND
Get information about commands.
Syntax
COMMAND [INFO [command ...]]
Get detailed information about specific commands
One or more command names
Return value
Array of command metadata
Examples
redis-cli> COMMAND INFO GET SET
1) 1) "get"
2) (integer) 2
3) 1) "readonly"
4) (integer) 1
5) (integer) 1
6) (integer) 1
2) 1) "set"
2) (integer) -3
3) 1) "write"
4) (integer) 1
5) (integer) 1
6) (integer) 1
Time complexity: O(N) where N is the number of commands requested
COMMAND COUNT
Get the number of supported commands.
Syntax
Return value
The number of commands supported by the server
Examples
redis-cli> COMMAND COUNT
(integer) 150
Time complexity: O(1)
COMMAND LIST
Get the list of all command names.
Syntax
Return value
Array of all command names
Examples
redis-cli> COMMAND LIST
1) "get"
2) "set"
3) "del"
...
150) "flushall"
Time complexity: O(N) where N is the number of commands
CONFIG GET
Get the value of configuration parameters.
Syntax
Glob pattern to match parameter names
Return value
Array of parameter-value pairs
Examples
redis-cli> CONFIG GET *
1) "bind"
2) "127.0.0.1"
3) "port"
4) "6379"
5) "workers"
6) "4"
7) "data_dir"
8) "/var/lib/kora"
redis-cli> CONFIG GET port
1) "port"
2) "6379"
Time complexity: O(N) where N is the number of matching parameters
CONFIG SET
Set a configuration parameter.
Syntax
CONFIG SET parameter value
The configuration parameter name
Return value
OK if the parameter was set successfully
Examples
redis-cli> CONFIG SET save "900 1 300 10"
OK
redis-cli> CONFIG SET maxmemory "2gb"
OK
Time complexity: O(1)
Notes:
- Only certain parameters can be changed at runtime
- Some changes require server restart to take effect
- Changes are not persisted (edit config file for persistence)
CONFIG RESETSTAT
Reset server statistics.
Syntax
Return value
Examples
redis-cli> CONFIG RESETSTAT
OK
Time complexity: O(1)
Notes:
- Resets command counters, latency stats, and network I/O counters
- Does not reset memory usage or keyspace stats
CLIENT ID
Get the current connection ID.
Syntax
Return value
Examples
redis-cli> CLIENT ID
(integer) 42
Time complexity: O(1)
CLIENT SETNAME
Set the connection name.
Syntax
Return value
Examples
redis-cli> CLIENT SETNAME myapp:worker1
OK
Time complexity: O(1)
CLIENT GETNAME
Get the connection name.
Syntax
Return value
The connection name, or null if not set
Examples
redis-cli> CLIENT GETNAME
"myapp:worker1"
Time complexity: O(1)
CLIENT LIST
Get the list of all client connections.
Syntax
Return value
Information about connected clients (one per line)
Examples
redis-cli> CLIENT LIST
id=1 addr=127.0.0.1:52143 name=myapp:worker1 age=120 idle=0 cmd=get
id=2 addr=127.0.0.1:52144 name= age=60 idle=5 cmd=set
Time complexity: O(N) where N is the number of clients
TIME
Return the current server time.
Syntax
Return value
Array with two elements: [0] Unix timestamp in seconds, [1] microseconds
Examples
redis-cli> TIME
1) "1678901234"
2) "567890"
Time complexity: O(1)
SELECT
Select the database to use.
Syntax
The database index (only 0 is supported in Kora)
Return value
OK if the database was selected
Examples
redis-cli> SELECT 0
OK
redis-cli> SELECT 1
(error) ERR only database 0 is supported
Time complexity: O(1)
Notes:
- Kora currently supports only database 0
- Included for Redis protocol compatibility
QUIT
Close the connection.
Syntax
Return value
OK before closing the connection
Examples
Time complexity: O(1)
Redis Compatibility
Kora implements all essential Redis server commands with identical semantics. Commands behave as documented in the Redis specification.