Created
January 6, 2011 20:09
-
-
Save ianterrell/768486 to your computer and use it in GitHub Desktop.
Monkey patch for safety using flushall and flushdb
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
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