lib/protocol/redis/methods/server.rb in protocol-redis-0.8.1 vs lib/protocol/redis/methods/server.rb in protocol-redis-0.9.0
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
# Released under the MIT License.
-# Copyright, 2019-2023, by Samuel Williams.
+# Copyright, 2019-2024, by Samuel Williams.
# Copyright, 2020, by David Ortiz.
module Protocol
module Redis
module Methods
@@ -17,9 +17,25 @@
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
+ 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