Easy Tutorial
❮ Server Command Hashes Hlen ❯

Redis Dbsize Command

Redis Server

The Redis Dbsize command is used to return the number of keys in the current database.

Syntax

The basic syntax for the redis DBSIZE command is as follows:

redis 127.0.0.1:6379> DBSIZE

Available Versions

= 1.0.0

Return Value

The number of keys in the current database.

Example

redis 127.0.0.1:6379> DBSIZE
(integer) 5

redis 127.0.0.1:6379> SET new_key "hello_moto"     # Add a key to test
OK

redis 127.0.0.1:6379> DBSIZE
(integer) 6

Redis Server

❮ Server Command Hashes Hlen ❯