soveran / ohm

Object-Hash Mapping for Redis

Home Page:http://ohm.keyvalue.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Distribute updates to multiple Redis instances

damnitjim opened this issue · comments

I have use case where I'm trying to create a new model instance for an array of Redis hosts. I currently have this executing in a Sidekiq job, which relies on threads. I'm getting varying results of writes to each host. For example, I'll process 100 jobs and each host will not have the same number of updates. Is there any way to accomplish this with Ohm?

hosts = ['192.168.1.1', '192.168.1.2', '192.168.1.3','192.168.1.4']

hosts.each do |host|
  Event.redis = Redic.new("redis://#{host}:6379")
  Event.create :name => "Ohm Worldwide Conference 2031"
end