You can use wc to get the total number of keys based on the pattern.
➜ redis-cli --scan --pattern 'domain*'
"domain1:key2"
"domain3:key4"
"domain2:key3"
➜ redis-cli --scan --pattern 'domain*' | wc -l
3 You can use wc to get the total number of keys based on the pattern.
➜ redis-cli --scan --pattern 'domain*'
"domain1:key2"
"domain3:key4"
"domain2:key3"
➜ redis-cli --scan --pattern 'domain*' | wc -l
3