class Derrick::Fetcher
Public Class Methods
new(redis, input, output, progress)
click to toggle source
# File lib/derrick/fetcher.rb, line 5 def initialize(redis, input, output, progress) @redis = redis @input = input @output = output @progress = progress end
Public Instance Methods
run()
click to toggle source
# File lib/derrick/fetcher.rb, line 12 def run while (keys = @input.pop) != :stop @output.push(stats(keys)) end @output.push(:stop) end
stats(keys)
click to toggle source
# File lib/derrick/fetcher.rb, line 19 def stats(keys) types = @redis.pipelined do keys.each do |key| @redis.type(key) end end ttls = @redis.pipelined do keys.each do |key| @redis.ttl(key) end end @progress.increment_fetched(keys.size) keys.map.with_index do |key, index| Key.new(key, types[index], ttls[index]) end end