Class: McDump::Telnet::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/mc_dump/telnet/session.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#closeObject


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

#statsObject


15
16
17
# File 'lib/mc_dump/telnet/session.rb', line 15

def stats
  @connection.execute("stats items")
end