Search code examples
memoryredisredis-cli

How to get the memory size of a list in Redis?


I'm storing a very large list of strings in Redis and I'm trying to figure out if there is a command (or any other way) to get the memory used by that list. Any suggestions?

I went over the list of Redis commands by couldn't find anything relevant.


Solution

  • Currently Redis doesn't provide this type of introspective memory abilities. Your best bet at the moment is to DUMP the list and then RESTORE it to an empty database. Use INFO's memory section from target database before & after restoring the list and subtract the former from the latter to get the size estimate.