Skip to content

Instantly share code, notes, and snippets.

@wevtimoteo
Last active June 28, 2018 13:39
Show Gist options
  • Save wevtimoteo/f6c9fd91908f7dbe622bf23f7a38b2ae to your computer and use it in GitHub Desktop.
Save wevtimoteo/f6c9fd91908f7dbe622bf23f7a38b2ae to your computer and use it in GitHub Desktop.
Removing keys by namespace with Redis-RB
%w(
months*
extract*
payment*
consolidate*
agenda*
brands
car_model*
car*
visit_types*
).each do |wildcard|
keys = $redis.keys(wildcard)
unless keys.empty?
puts " --> With wildcard #{wildcard}, removing #{keys.size} keys..."
puts $redis.del(*keys)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment