Skip to content

Instantly share code, notes, and snippets.

@salvorapi
Forked from patrickhulce/findkeys.sh
Created July 10, 2023 10:09
Show Gist options
  • Select an option

  • Save salvorapi/f78d33f08684230a2afa256538790f18 to your computer and use it in GitHub Desktop.

Select an option

Save salvorapi/f78d33f08684230a2afa256538790f18 to your computer and use it in GitHub Desktop.
Find all keys without a TTL in Redis
#!/bin/sh
redis-cli keys "*" | head -n $1 > keys.txt
cat keys.txt | xargs -n 1 -L 1 redis-cli ttl > ttl.txt
paste -d " " keys.txt ttl.txt | grep .*-1$ | cut -d " " -f 1 | redis-cli del
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment