↑ ↓ select, Enter open, Esc close

Count the keys in a Redis database

Adjust the values, the command updates live
user@server
redis-cli -n 0 DBSIZE

Returns the number of keys in the database selected with -n as a single number. DBSIZE only reads an internal counter, so it finishes instantly even with millions of keys. Handy for comparing before and after a cache flush or a plugin change.

Also searched as

  • how many keys in redis
  • redis database size
  • number of entries in object cache

Related one-liners

All in Redis and Memcached

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.