Created
March 10, 2011 09:57
-
-
Save solars/863846 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
# see https://github.com/antirez/redis/blob/master/redis.conf | |
# set set-max-intset-entries 512 to 4096 for our purpose (3000 hotels) | |
# https://github.com/kni/redis-sharding | |
# http://groups.google.com/group/redis-db/browse_thread/thread/ba41db36013c7cb9 | |
# | |
require 'rubygems' | |
require "redis" | |
require 'date' | |
redis = Redis.new | |
redis.flushall | |
oldmem = redis.info['used_memory'].to_i | |
(1..3000).each do |hotel| | |
puts hotel if hotel % 50 == 0 | |
(1..365).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 | |
#redis.sadd '1111_3', 55 | |
#puts redis.get '1111_3' | |
#redis.get "2010-11-01_3_3_4_0", "AT_ZELL_AM_SEE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment