Created
February 7, 2012 06:15
-
-
Save jherdman/1757615 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'hiredis' | |
require 'redis' | |
redis = Redis.new | |
num_entries = ARGV.shift.to_i | |
puts "Flusing existing entries" | |
redis.flushall | |
puts "And away we go!" | |
time_start = Time.now | |
num_entries.times do |count| | |
num_keys = rand(1..10) | |
items = Array.new(num_keys, 'a') | |
key = "exp:#{count}" | |
redis.multi do |r| | |
items.each do |v| | |
r.sadd(key, v) | |
end | |
end | |
end | |
time_end = Time.now | |
puts "This took #{time_end - time_start} seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment