how to cache a pre-compiled query?
Wednesday, 6 June 2012 · 2 messages
MS
Hi Maurice,
Quoted text · Mauricio S. Castro · 2 lines
Am 06.06.2012 um 14:30 schrieb Mauricio S. Castro: > I am trying to use QueryProcessor to compile and cache for later, in case no used modules have changed, is this ok?
I suppose this will not work, unfortunatedly:
the query processor contains some (dynamically evaluated like databases to access) yet stateful information that makes it impossible to cache.
Quoted text · Mauricio S. Castro · 2 lines
> > Can I concurrently use QueryProcessor within the same JVM in different threads?
For those very reasons I'd suggest you to use ThreadLocals [1] and a dedicated processor per Thread; that way you are definitely on the safe side.
Creating an instance of QueryProcessor should be a rather lightweight operation, as such I hope this suits your needs.
I hope this helped, feel free to ask for more!
Kind regards
Michael
[1] http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html
MC
Mauricio S. Castro6 Jun 2012 16:31 #
I am trying to use QueryProcessor to compile and cache for later, in case no used modules have changed, is this ok?
Can I concurrently use QueryProcessor within the same JVM in different threads?
Thanks.
--
Maurício Santiago de Castro
mauricioscastro at hotmail.com
<mailto:mauricioscastro at hotmail.com><http://br.linkedin.com/pub/mauricio-castro/17/275/a5b><http://www.delicious.com/mscastro><http://twitter.com/#%21/mauricioscastro>mauriciosantiagodecastro@facebook <http://facebook.com/mauriciosantiagodecastro><https://mscastro.startssl.com/>
Written for BaseX 7.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery