Created
August 5, 2024 09:42
-
-
Save bilbof/a93078c09abaf53357f66c53ce34df75 to your computer and use it in GitHub Desktop.
redis ruby bigkeys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis = Redis.new | |
top_n = 20 | |
# top N keys and their size in kb | |
big_keys = redis.keys.map { |k| [k, redis.memory("usage", k) / 1024.0] }.sort_by { |a,b| b }.last(top_n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment