Module: EventMachine::Protocols::Redis
- Included in:
- PubSubRedis
- Defined in:
- lib/htttee/server/ext/em-redis.rb
Instance Method Summary collapse
Instance Method Details
#multi(*command_groups, &blk) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/htttee/server/ext/em-redis.rb', line 26 def multi(*command_groups, &blk) command = "*1\r\n$5\r\nMULTI\r\n" command_groups.each do |argv| command << "*#{argv.size}\r\n" argv.each do |a| a = a.to_s command << "$#{get_size(a)}\r\n" command << a command << "\r\n" end end command << "*1\r\n$4\r\nEXEC\r\n" maybe_lock do @redis_callbacks << [REPLY_PROCESSOR['multi'], blk] send_data command end end |
#pipeline(*commands, &blk) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/htttee/server/ext/em-redis.rb', line 5 def pipeline(*commands, &blk) command = '' commands.each do |argv| command << "*#{argv.size}\r\n" argv.each do |a| a = a.to_s command << "$#{get_size(a)}\r\n" command << a command << "\r\n" end end maybe_lock do commands.map {|c| c.first }.each do |command_name| @redis_callbacks << [REPLY_PROCESSOR[command_name], blk] end send_data command end end |