I didn't think we could cache traversals that way given:

> So, while you can clone() a traversal and re-use it, you can't change its
parameterization because its already been compiled and during compilation,
many of those parameters were used to determine how it would be compiled.

and we certainly don't have a "traversal cache" in Gremlin Server. The only
thing bindings would help with to my knowledge is with parameterized
scripts in a lambda.

On Thu, Jun 22, 2017 at 2:37 PM, Robert Dale <robd...@gmail.com> wrote:

> Given https://issues.apache.org/jira/browse/TINKERPOP-1444
> and
> https://lists.apache.org/thread.html/b5ac4d4b51ccaefdab0005f7d70501
> bae74aaeb2e1313fbb50b76ccd@%3Cdev.tinkerpop.apache.org%3E
>
> I believe that makes the following section under withRemote false wrt to
> caching a parameterized traversal and being able to reuse it with different
> params. Should this be removed or updated?
>
>
> Finally, Gremlin Bytecode supports the encoding of bindings which allow
> GremlinServer to cache traversals that will be reused over and over again
> save that some parameterization may change. Thus, instead of translating,
> compiling, and then executing each submitted bytecode, it is possible to
> simply execute. To express bindings in Gremlin-Java and Gremlin-Groovy, use
> Bindings.
>
> gremlin> cluster = Cluster.open('conf/remote-objects.yaml')
> ==>localhost/127.0.0.1:8182
> gremlin> b = Bindings.instance()
> ==>bindings[main]
> gremlin> g = EmptyGraph.instance().traversal().withRemote(
> DriverRemoteConnection.using(cluster,
> "g"))
> ==>graphtraversalsource[emptygraph[empty], standard]
> gremlin> g.V(b.of('id',1)).out('created').values('name')
> ==>lop
> gremlin> g.V(b.of('id',4)).out('created').values('name')
> ==>ripple
> ==>lop
> gremlin> g.V(b.of('id',4)).out('created').values('name').getBytecode()
> ==>[[], [V(binding[id=4]), out(created), values(name)]]
> gremlin> g.V(b.of('id',4)).out('created').values('name').
> getBytecode().getBindings()
> ==>id=4
> gremlin> cluster.close()
> ==>null
>
> Both traversals are abstractly defined as
> g.V(id).out('created').values('name') and thus, the first submission can
> be
> cached for faster evaluation on the next submission.
>
>
>
> Robert Dale
>

Reply via email to