Skip to content

Instantly share code, notes, and snippets.

@espeed
Created August 23, 2011 05:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save espeed/1164389 to your computer and use it in GitHub Desktop.
Save espeed/1164389 to your computer and use it in GitHub Desktop.
Talk to Redis while you walk Gremlin
// Talk to Redis while you walk Gremlin
// by James Thornton, http://jamesthornton.com
import redis.clients.jedis.*;
Jedis jedis = new Jedis("localhost");
g = TinkerGraphFactory.createTinkerGraph();
talk2redis = {
_().sideEffect{ jedis.incr(it.name); }
}
Gremlin.defineStep("talk", [Vertex,Pipe], talk2redis);
g.v(1).both.talk().loop(2){it.loops < 10} >> -1;
println "Marko: " + jedis.get("marko");
println "Peter: " + jedis.get("peter");
println "Josh: " + jedis.get("josh");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment