Skip to content

Instantly share code, notes, and snippets.

@ianterrell
Created January 6, 2011 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianterrell/768486 to your computer and use it in GitHub Desktop.
Save ianterrell/768486 to your computer and use it in GitHub Desktop.
Monkey patch for safety using flushall and flushdb
require 'redis'
class Redis
alias :__flushall :flushall
alias :__flushdb :flushdb
def flushall(confirm=false)
if confirm
__flushall
else
puts "This will delete all of the data in all the Redis databases. Pass 'true' as a parameter to actually do this."
end
end
def flushdb(confirm=false)
if confirm
__flushdb
else
puts "This will delete all of the data in the current Redis database. Pass 'true' as a parameter to actually do this."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment