Skip to content

Instantly share code, notes, and snippets.

@solars
Created March 9, 2011 10:27
Show Gist options
  • Save solars/862000 to your computer and use it in GitHub Desktop.
Save solars/862000 to your computer and use it in GitHub Desktop.
# create availabilities for hotels
# each set contains the hotels which have availability
# for a particular day (specified by id) / guest-count
redis = Redis.new
redis.flushall
oldmem = redis.info['used_memory'].to_i
(1..3000).each do |hotel|
puts hotel if hotel % 50 == 0
(1..10).each do |day|
for adult in 1..10
redis.sadd "#{day}_#{adult}", hotel.to_i
end
end
end
newmem = redis.info['used_memory'].to_i
puts 'mem: ' + (newmem-oldmem).to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment