Class: Redu::RedisDebugObject

Inherits:
Object
  • Object
show all
Defined in:
lib/redu/analyzer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, string) ⇒ RedisDebugObject

Returns a new instance of RedisDebugObject.



68
69
70
71
72
73
74
75
# File 'lib/redu/analyzer.rb', line 68

def initialize(key,string)
  @key = key
  if string =~ /serializedlength:(\d+)/
    @bytesize = $1.to_i
  else
    raise "Invalid matching for #{string}"
  end
end

Instance Attribute Details

#bytesizeObject

“Value at:0x7f93e48464e0 refcount:1 encoding:raw serializedlength:230 lru:710236 lru_seconds_idle:2040”



62
63
64
# File 'lib/redu/analyzer.rb', line 62

def bytesize
  @bytesize
end

#keyObject

“Value at:0x7f93e48464e0 refcount:1 encoding:raw serializedlength:230 lru:710236 lru_seconds_idle:2040”



62
63
64
# File 'lib/redu/analyzer.rb', line 62

def key
  @key
end

Class Method Details

.initialize_from_string(key, string) ⇒ Object



64
65
66
# File 'lib/redu/analyzer.rb', line 64

def self.initialize_from_string(key,string)
  RedisDebugObject.new(key,string)
end

Instance Method Details

#<=>(other) ⇒ Object



81
82
83
# File 'lib/redu/analyzer.rb', line 81

def <=>(other)
  self.bytesize <=> other.bytesize
end

#inspectObject



77
78
79
# File 'lib/redu/analyzer.rb', line 77

def inspect
  "rdo:(#{@key},#{@bytesize})"
end