Class: Yuki::Store::TokyoTyrant

Inherits:
AbstractStore show all
Defined in:
lib/store/tyrant.rb

Instance Method Summary collapse

Methods inherited from AbstractStore

#<<, #[], #[]=, #any?, #delete!, #empty?, #filter, #keys, #union

Constructor Details

#initialize(config = {}) ⇒ TokyoTyrant

Returns a new instance of TokyoTyrant.



6
7
8
9
# File 'lib/store/tyrant.rb', line 6

def initialize(config = {})
  @socket = config[:socket] if config.include? :socket
  @host, @port = config[:host], config[:port]
end

Instance Method Details

#statObject



18
19
20
# File 'lib/store/tyrant.rb', line 18

def stat
  open { |db| db.stat.inject('') { |s, (k, v)| s << "#{k} => #{v}\n" } }
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/store/tyrant.rb', line 11

def valid?
  unless(socket_valid? || host_and_port_valid?)
    errors.size < 2
  else {}
  end
end