Skip to content

Instantly share code, notes, and snippets.

@Xenofex
Created May 20, 2018 00:43
Show Gist options
  • Save Xenofex/abc149aafe76b8ace76856685e027ed8 to your computer and use it in GitHub Desktop.
Save Xenofex/abc149aafe76b8ace76856685e027ed8 to your computer and use it in GitHub Desktop.
Search redis keys for a pattern, get total memory usage of all the keys and values of them
redis-keys-size() {
redis-cli keys "$1" | awk '{ system("redis-cli memory usage \x27" $0 "\x27") }' | cut -d ' ' -f 2 | awk '{s+=$1} END {print s}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment