lib/redis.rb in redis-4.0.0 vs lib/redis.rb in redis-4.0.1
- old
+ new
@@ -235,23 +235,35 @@
end
end
# Remove all keys from all databases.
#
+ # @param [Hash] options
+ # - `:async => Boolean`: async flush (default: false)
# @return [String] `OK`
- def flushall
+ def flushall(options = nil)
synchronize do |client|
- client.call([:flushall])
+ if options && options[:async]
+ client.call([:flushall, :async])
+ else
+ client.call([:flushall])
+ end
end
end
# Remove all keys from the current database.
#
+ # @param [Hash] options
+ # - `:async => Boolean`: async flush (default: false)
# @return [String] `OK`
- def flushdb
+ def flushdb(options = nil)
synchronize do |client|
- client.call([:flushdb])
+ if options && options[:async]
+ client.call([:flushdb, :async])
+ else
+ client.call([:flushdb])
+ end
end
end
# Get information and statistics about the server.
#
@@ -2733,9 +2745,19 @@
"#<Redis client v#{Redis::VERSION} for #{id}>"
end
def dup
self.class.new(@options)
+ end
+
+ def connection
+ {
+ host: @original_client.host,
+ port: @original_client.port,
+ db: @original_client.db,
+ id: @original_client.id,
+ location: @original_client.location
+ }
end
def method_missing(command, *args)
synchronize do |client|
client.call([command] + args)