Sha256: 122b740b5bf898980d9143d4e70b993e2696c7a20920914a362ea3eb91aa77e0

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2023, by Samuel Williams.
# Copyright, 2020, by David Ortiz.

module Protocol
	module Redis
		module Methods
			module Server
				# Get information and statistics about the server.
				# @see https://redis.io/commands/info
				# @param section [String]
				def info
					metadata = {}
					
					call('INFO').each_line(Redis::Connection::CRLF) do |line|
						key, value = line.split(':')
						
						if value
							metadata[key.to_sym] = value.chomp!
						end
					end
					
					return metadata
				end
				
				# Remove all keys from the current database.
				# @see https://redis.io/commands/flushdb
				# @param async [Enum]
				def flushdb!
					call('FLUSHDB')
				end
			end
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
protocol-redis-0.8.1 lib/protocol/redis/methods/server.rb
protocol-redis-0.8.0 lib/protocol/redis/methods/server.rb
protocol-redis-0.7.0 lib/protocol/redis/methods/server.rb