MEMORY USAGE returns the approximate bytes a key and its value take in Redis. The example below takes one key at a time and use it with MEMORY USAGE. In the example below, existing keys have identical sizes because they have the same values. But the third and new key has different memory usage since its value is larger than the previous two.
➜ redis-cli --scan --pattern 'domain*' | xargs -r -n1 redis-cli MEMORY USAGE
(integer) 48
(integer) 48
➜ redis-cli KEYS 'domain*' | xargs -r -n1 redis-cli MGET
1) "value2"
1) "value3"
➜ redis-cli KEYS 'domain*'
1) "domain1:key2"
2) "domain2:key3"
➜ redis-cli SET 'domain3:key4' value44444444444444444444444444444444444444
OK
➜ redis-cli KEYS 'domain*' | xargs -r -n1 redis-cli MGET
1) "value2"
1) "value3"
1) "value44444444444444444444444444444444444444"
➜ redis-cli --scan --pattern 'domain*' | xargs -r -n1 redis-cli MEMORY USAGE
(integer) 80
(integer) 48
(integer) 48