Skip to content

Instantly share code, notes, and snippets.

@jherdman
Created February 7, 2012 06:15
Show Gist options
  • Save jherdman/1757615 to your computer and use it in GitHub Desktop.
Save jherdman/1757615 to your computer and use it in GitHub Desktop.
#!/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