Created
April 12, 2013 20:52
-
-
Save rkroll/5375046 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
TitanGraph g = titanGraphService.getSingleton() | |
In a job: | |
while(true) { | |
Vertex vertex = g.addVertex(null); | |
vertex.setProperty("foo", "bar"); | |
batchCount++; | |
if(batchCount % 1000 == 0) { g.commit() } | |
} | |
Then in a separate (Jersey) class: | |
TitanGraph g = titanGraphService.getSingleton(); | |
Iterable<Vertex> v = titanGraph.query().vertices() | |
int count = 0; | |
while(v.hasNext()) { | |
count++; | |
} | |
The first time you access the jersey class, count will be for example 2000, then on every subsequent request, count will be 2000 (always returns the cached result). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment