5 def initialize(opts={})
6 opts = {:port => 6379, :host => 'localhost', :basedir => "#{Dir.pwd}/rdsrv" }.merge(opts)
7 FileUtils.mkdir_p opts[:basedir]
8 opts[:size].times do |i|
10 FileUtils.mkdir_p "#{opts[:basedir]}/#{port}"
11 File.open("#{opts[:basedir]}/#{port}.conf", 'w'){|f| f.write(make_config(port, "#{opts[:basedir]}/#{port}", "#{opts[:basedir]}/#{port}.log"))}
12 system(%Q{#{File.join(File.expand_path(File.dirname(__FILE__)), "../redis/redis-server #{opts[:basedir]}/#{port}.conf &" )}})
16 def make_config(port=6379, data=port, logfile='stdout', loglevel='debug')
33 RedisCluster.new :size => 4