Class: McDump::Telnet::Session
- Inherits:
-
Object
- Object
- McDump::Telnet::Session
- Defined in:
- lib/mc_dump/telnet/session.rb
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(connection_args) ⇒ Session
constructor
A new instance of Session.
- #items(id, number) ⇒ Object
- #stats ⇒ Object
Constructor Details
#initialize(connection_args) ⇒ Session
Returns a new instance of Session.
11 12 13 |
# File 'lib/mc_dump/telnet/session.rb', line 11 def initialize(connection_args) @connection = McDump::Telnet::Connection.new(connection_args) end |
Class Method Details
.open(connection_args, &block) ⇒ Object
6 7 8 9 |
# File 'lib/mc_dump/telnet/session.rb', line 6 def self.open(connection_args, &block) session = self.new(connection_args) block.call(session).tap { session.close } end |
Instance Method Details
#close ⇒ Object
23 24 25 |
# File 'lib/mc_dump/telnet/session.rb', line 23 def close @connection.close end |
#items(id, number) ⇒ Object
19 20 21 |
# File 'lib/mc_dump/telnet/session.rb', line 19 def items(id, number) @connection.execute("stats cachedump #{id} #{number}") end |
#stats ⇒ Object
15 16 17 |
# File 'lib/mc_dump/telnet/session.rb', line 15 def stats @connection.execute("stats items") end |