Module: Emb::Commands
- Included in:
- Client
- Defined in:
- lib/emb/commands.rb
Overview
Server-status and runtime-config command wrappers. They only depend on #send_command, so they live in this module (included into Emb::Client) rather than growing the client class.
Instance Method Summary collapse
-
#server_info(*sections) ⇒ Object
Server-wide INFO (the Redis-style sectioned command).
-
#stats ⇒ Object
EMB.STATS as a Symbol-keyed Hash.
Instance Method Details
#server_info(*sections) ⇒ Object
Server-wide INFO (the Redis-style sectioned command). No sections = all sections; any number of sections filter the reply.
18 19 20 |
# File 'lib/emb/commands.rb', line 18 def server_info(*sections) parse_info(send_command('INFO', *sections.map(&:to_s))) end |
#stats ⇒ Object
EMB.STATS as a Symbol-keyed Hash. No client-side type layer: values are exactly what the RESP decoder returned (Integer where the server sends RESP integers, String otherwise).
11 12 13 14 |
# File 'lib/emb/commands.rb', line 11 def stats raw = send_command('EMB.STATS') raw.each_slice(2).to_h { |key, value| [key.to_sym, value] } end |