Created
July 22, 2011 09:56
-
-
Save mattb/1099185 to your computer and use it in GitHub Desktop.
This file contains 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
object Load { | |
def main(args: Array[String]) { | |
val pool = new JedisPool(new JedisPoolConfig, "localhost"); | |
new File(".").list.filter( _.toLowerCase.endsWith(".gz") ) map { | |
file => spawn { | |
println(file + " started."); | |
val in = new BufferedSource(new GZIPInputStream(new FileInputStream(file))); | |
val jedis = pool.getResource; | |
for(fields <- in.getLines.map { line => line.split(":") }) { | |
jedis.set(fields(0),fields(1)); | |
} | |
pool.returnResource(jedis); | |
println(file + " done."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment