Skip to content

Instantly share code, notes, and snippets.

@mattb
Created July 22, 2011 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattb/1099185 to your computer and use it in GitHub Desktop.
Save mattb/1099185 to your computer and use it in GitHub Desktop.
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