Protocol::RedisSourceProtocolRedisMethodsServer

module Server

Methods for managing Redis servers.

Definitions

def info

Get information and statistics about the server. See https://redis.io/commands/info for more details.

Signature

parameter section String

Implementation

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

def client_info

Get the client information for the current connection. See https://redis.io/commands/client-info for more details.

Signature

returns Hash

A hash containing client metadata.

Implementation

def client_info
	metadata = {}
	
	call("CLIENT", "INFO").split(/\s+/).each do |pair|
		key, value = pair.split("=")
		
		if value
			metadata[key.to_sym] = value
		else
			metadata[key.to_sym] = nil
		end
	end
	
	return metadata
end

def flushdb!

Remove all keys from the current database. See https://redis.io/commands/flushdb for more details.

Signature

parameter async Enum

Implementation

def flushdb!
	call("FLUSHDB")
end