Home > Enterprise >  number of element in Redis namespace
number of element in Redis namespace

Time:02-13

I have redis like this enter image description here

is there any way to count the number of elements in each namespace with python? I found HGETALL and DBSIZE but didn't work for me.

CodePudding user response:

You can use command "scan db_index" like "scan 0" or command "info keyspace" for all database indexes and get key count, average ttl (expiration time) and expires keys. You can also use two commands "select db_index" which db_index is 0,1,2,...,15 and the other command "dbsize" to get database key count. The command "info" show a lot info about system specifications and redis.

  • Related