Class: EM::Tycoon::Protocol::Binary::RemoveMessage
- Defined in:
- lib/em/tycoon/protocol/binary/remove_message.rb
Constant Summary
Constants inherited from Message
Message::DEFAULT_OPTS, Message::FLAGS, Message::KV_PACK_FMT, Message::MAGIC, Message::MSG_TYPES, Message::NO_EXPIRATION_TIME, Message::NO_XT_HEX, Message::PARSE_PHASES
Instance Attribute Summary
Attributes inherited from Message
#buffer, #bytes_expected, #data, #item_count, #keysize, #magic, #parse_phase, #parsed, #type, #valuesize
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data = nil, opts = {}) ⇒ RemoveMessage
constructor
A new instance of RemoveMessage.
Methods inherited from Message
#[], check_msg_type, message_for, msg_type_for, #parse, #parse_chunk, #parsed?
Constructor Details
#initialize(data = nil, opts = {}) ⇒ RemoveMessage
Returns a new instance of RemoveMessage.
7 8 9 |
# File 'lib/em/tycoon/protocol/binary/remove_message.rb', line 7 def initialize(data=nil,opts={}) super(:remove,data) end |
Class Method Details
.generate(data, opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/em/tycoon/protocol/binary/remove_message.rb', line 11 def self.generate(data,opts={}) data = [data.to_s] unless data.kind_of?(Array) msg_array = [MAGIC[:remove]] optflags = 0 opts.each_pair do |optkey,optval| optflags |= FLAGS[optkey] if (FLAGS.has_key?(optkey) and (optval == true)) end msg_array << optflags msg_array << data.length data.each do |d| msg_array << 0 # dbidx msg_array << d.to_s.bytesize msg_array << d end return msg_array.pack("CNN#{'nNa*'*data.length}") end |