Commands | Description |
---|---|
XADD mystream * message 1 | Add to stream to insert {message: 1} |
XLEN mystream | Length of messages in mystream |
XRANGE mystream - + COUNT 2 | Return the first two elements |
XREAD COUNT 2 STREAMS mystream 0 | Read 2 elements in stream from the beginning |
XREAD BLOCK 0 STREAMS mystream $ | Wait indefinitely until a message |
XREAD BLOCK 1000 STREAMS mystream $ | Wait for 1 second for a message else timeout |
XGROUP CREATE mystream group1 $ | Create a group1 in consumer group in a stream |
XREADGROUP GROUP group1 cons1 COUNT 1 STREAMS mystream > | Consume new messages as cons1 in group1 and get all the new messages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
require 'typhoeus' | |
def get_response(url, request_timeout) | |
# Raises exception on timeout | |
url = URI(url) | |
http = Net::HTTP.new(url.host, url.port) | |
request = Net::HTTP::Get.new url | |
http.read_timeout = request_timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
res = DEFAULT_REDIS_CLIENT.slowlog("GET", 128) | |
puts "Timestamp,Command,Time taken (in seconds)" | |
res.each do |one_list_item| | |
puts "\"#{Time.at(one_list_item[1])}\",\"#{one_list_item[3].join(' ')}\",#{one_list_item[2]*1.0/1000000}" | |
end |
OlderNewer