Skip to content

Instantly share code, notes, and snippets.

@antirez
Created October 22, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antirez/e024c9479cdb4dbad4a3 to your computer and use it in GitHub Desktop.
Save antirez/e024c9479cdb4dbad4a3 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'redis'
r = Redis.new
item_id = 0
r.pipelined {
5000000.times {
room = sprintf("%.4d",rand(1000))
price = sprintf("%.2f",(rand(10000)/100.0))
price = "0"+price if price.length < 5
r.zadd("myindex",0,"#{room}:#{price}:#{item_id}")
item_id += 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment