Skip to content

Instantly share code, notes, and snippets.

@taotetek
Created October 15, 2010 12:12
Show Gist options
  • Save taotetek/628094 to your computer and use it in GitHub Desktop.
Save taotetek/628094 to your computer and use it in GitHub Desktop.
require 'java'
require 'jredis-core-all-a.0-SNAPSHOT-jar-with-dependencies.jar'
java_import 'org.jredis.ri.alphazero.JRedisClient'
pool = []
(1..1000).each do |thread_num|
pool << Thread.new(thread_num) {
jredis = JRedisClient.new()
(1..1000).each do |value|
key = "key::#{value}"
jredis.set(key, value.to_s)
end
}
end
pool.each {|thread_num| thread_num.join}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment