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 of 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"     # 增加一个 key 试试
OK

redis 127.0.0.1:6379> DBSIZE
(integer) 6

Redis Server

Other Extensions