Redis 8 cheatsheet

Redis 8: Administration

9 common Redis 8 tasks.

Count keys

Number of keys in the current database.

DBSIZE

Check memory use

Show memory statistics such as used_memory and the maxmemory limit.

INFO memory

Check one key's size

Show how many bytes a key and its value use.

MEMORY USAGE user:1

See slow commands

Show the 10 most recent slow commands.

SLOWLOG GET 10

List connected clients

Show each connection and what it last ran.

CLIENT LIST

Read a setting

Show the current maxmemory setting.

CONFIG GET maxmemory

Save a snapshot

Write the dataset to disk in the background.

BGSAVE

Delete every key in the database

Remove all keys from the current database.

FLUSHDB

Caution: Permanently deletes all keys in the selected database. Check which one you are connected to.

Watch every command

Stream all commands the server receives.

MONITOR

Caution: Slows the server noticeably. Use it briefly and avoid it on busy production servers.

Was this page helpful?